在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
[DllImport("User32.dll ", EntryPoint = "SetParent")] private static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent); [DllImport("user32.dll ", EntryPoint = "ShowWindow")] public static extern int ShowWindow(IntPtr hwnd, int nCmdShow); private void button3_Click(object sender, EventArgs e) { Process p = new Process(); p.StartInfo.FileName = "cmd.exe "; 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); } [DllImport("User32.dll ", EntryPoint = "SetParent")] private static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent); [DllImport("user32.dll ", EntryPoint = "ShowWindow")] public static extern int ShowWindow(IntPtr hwnd, int nCmdShow); private void button3_Click(object sender, EventArgs e) { Process p = new Process(); p.StartInfo.FileName = "cmd.exe "; 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); } |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论