我是这样设置,,可是有些exe程序是可以,但是在继续点击exe程序里的窗体,就不在里面了,而且用qq测试,qq不会嵌入进去,这是什么问题呢? appWin = IntPtr.Zero; Process p = null; try { p = System.Diagnostics.Process.Start(this.exeName); p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Minimized; p.WaitForInputIdle(); appWin = p.MainWindowHandle; } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error"); } // Put it into this form SetParent(appWin, this.Handle); // Remove border and whatnot SetWindowLong(appWin, GWL_STYLE, WS_VISIBLE); // Move the window to overlay it on this window MoveWindow(appWin, 0, 0, this.Width, this.Height, true);
Process p = null;
try
{
p = System.Diagnostics.Process.Start(this.exeName);
p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Minimized;
p.WaitForInputIdle();
appWin = p.MainWindowHandle;
}
catch (Exception ex)
{
MessageBox.Show(this, ex.Message, "Error");
} // Put it into this form
SetParent(appWin, this.Handle); // Remove border and whatnot
SetWindowLong(appWin, GWL_STYLE, WS_VISIBLE); // Move the window to overlay it on this window
MoveWindow(appWin, 0, 0, this.Width, this.Height, true);