0
cpecified 크기 아 파크 cpecified 위치에 새 브라우저 창을 시작하고 다음과 같이 브라우저의 새 인스턴스를 크기를 조정하려고합니다 :어떻게 새 인스턴스를 만들
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern bool GetWindowInfo(IntPtr hwnd, ref tagWINDOWINFO pwi);
[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]
public struct tagRECT
{
/// LONG->int
public int left;
/// LONG->int
public int top;
/// LONG->int
public int right;
/// LONG->int
public int bottom;
}
[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]
public struct tagWINDOWINFO
{
/// DWORD->unsigned int
public uint cbSize;
/// RECT->tagRECT
public tagRECT rcWindow;
/// RECT->tagRECT
public tagRECT rcClient;
/// DWORD->unsigned int
public uint dwStyle;
/// DWORD->unsigned int
public uint dwExStyle;
/// DWORD->unsigned int
public uint dwWindowStatus;
/// UINT->unsigned int
public uint cxWindowBorders;
/// UINT->unsigned int
public uint cyWindowBorders;
/// ATOM->WORD->unsigned short
public ushort atomWindowType;
/// WORD->unsigned short
public ushort wCreatorVersion;
}
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern bool UpdateWindow(IntPtr hWnd);
private void button2_Click(object sender, EventArgs e)
{
using (System.Diagnostics.Process browserProc = new System.Diagnostics.Process())
{
browserProc.StartInfo.FileName = webBrowser1.Url.ToString();
browserProc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Minimized;
int i= browserProc.Id;
tagWINDOWINFO info = new tagWINDOWINFO();
info.cbSize = (uint)System.Runtime.InteropServices.Marshal.SizeOf(info);
browserProc.Start();
GetWindowInfo(browserProc.MainWindowHandle, ref info);
browserProc.WaitForInputIdle();
string str = browserProc.MainWindowTitle;
MoveWindow(browserProc.MainWindowHandle, 100, 100, 100, 100, true);
UpdateWindow(browserProc.MainWindowHandle);
}
}
그러나 나는 "어떤 프로세스가이 객체에 연결되지 않습니다 얻을 ". 아무도 도와 줄 수 있습니까? 또는 다른 아이디어를 어떻게 새 브라우저 창 whith 지정된 크기와 위치를 실행하려면?