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);   
  
        } 


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/songkexin/archive/2010/07/26/5766169.aspx

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-01
  • 2022-12-23
  • 2021-06-13
猜你喜欢
  • 2021-12-17
  • 2021-09-12
  • 2022-12-23
  • 2022-12-23
  • 2021-07-04
  • 2021-08-08
  • 2021-06-08
相关资源
相似解决方案