Process myProcess = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo("deskmonview.exe", monitorIp);
myProcess.StartInfo = startInfo;
myProcess.StartInfo.UseShellExecute = false;
myProcess.Start();如上面代码,我怎么把deskmonview.exe程序放到一个panel中显示?
public static extern int SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
[DllImport("user32", EntryPoint = "FindWindowA", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll", EntryPoint = "SendMessageA", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
private static extern int SendMessage(int hwnd, int wMsg, int wParam, int lParam);
[DllImport("shell32.dll", EntryPoint = "ShellExecuteA", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
private static extern int ShellExecute(int hwnd, string lpOperation, string lpFile, string lpParameters, string lpDirectory, int nShowCmd);
private const int WM_SYSCOMMAND = 0x112;
private const int SC_MAXIMIZE = 0xF030;
private const int SC_MINIMIZE = 0xF020;
private const int SC_RESTORE = 0xF120;
public const int SW_HIDE = 0;
public const int SW_SHOW = 5;
[DllImport("user32.dll ", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
private static extern int ShowWindow(int hwnd, int nCmdShow);
ShellExecute(this.panel1.Handle.ToInt32(), "open", @"", null, ".", SW_HIDE);
IntPtr h = FindWindow(null, "");
var frm = (Control)Form.FromHandle(h);
SetParent(h, this.panel1.Handle);
SendMessage(h.ToInt32(), WM_SYSCOMMAND, SC_MAXIMIZE, 0);
ShowWindow(h.ToInt32(), SW_SHOW);