日期:2014-05-19  浏览次数:20964 次

怎样从我的程序里打开一个应用程序
怎样用代码实现从我的主窗体里打开另外一个应用程序,并且让该程序像自己的MDI子窗体那样在父窗体的范围内显示.

------解决方案--------------------
Process proc=Process.Start( "YourApplication.exe ");

要像MDI窗体那样在父窗体的范围内显示, 不清楚
------解决方案--------------------
[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);

public Form1()
{
InitializeComponent();

Process p= new Process();
p.StartInfo.FileName = "notepad ";

p.Start();

System.Threading.Thread.Sleep(100);

SetParent(p.MainWindowHandle, this.panel1.Handle);
ShowWindow(p.MainWindowHandle, 3);
}