view plaincopy to clipboardprint?
1. [DllImport("User32.dll ", EntryPoint = "SetParent")]
2.
3. private static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParen
t);
4.
5. [DllImport("user32.dll ", EntryPoint = "ShowWindow")]
6.
7. public static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
8.
9. private void button3_Click(object sender, EventArgs e)
10.
11.
12.
13.
14.
15.
16.
17.
p.StartInfo.FileName = "cmd.exe ";
Process p = new Process();
{
p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.
Minimized;//加上这句效果更好
p.Start();
System.Threading.Thread.Sleep(100);//加上,100 如果效果没有就继续加
大
SetParent(p.MainWindowHandle, panel1.Handle); //panel1.Handle 为
要显示外部程序的容器
ShowWindow(p.MainWindowHandle, 3);
}
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.