I've searched all over and incorporated this into my code:
我已经搜遍了所有并将其合并到我的代码中:
Process process = new Process();
process.StartInfo.FileName = exePath; //this is a valid path
process.Start();
Thread.Sleep(500);
process.WaitForInputIdle();
SetParent(process.MainWindowHandle, this.Handle);
However it starts the program normally in its own window and not inside my main form.
但是它通常在自己的窗口中而不是在我的主窗体内启动程序。
1 个解决方案
#1
0
I have found a possible solution here.
我在这里找到了可能的解决方案。
I have not tested the code.
我还没有测试过代码。
You need to ensure sure you set IsMdiContainer to true on the parent form.
您需要确保在父窗体上将IsMdiContainer设置为true。
Here is the implementation:
这是实施:
Form child = new Form();
Assembly asm = Assembly.LoadFile("c:\\executablefile.exe ");
Type type = asm.GetType("WindowsForm", true, true);
object childform = Activator.CreateInstance(type);
child = (Form)childform;
child.MdiParent = this;
child.Show();
#1
0
I have found a possible solution here.
我在这里找到了可能的解决方案。
I have not tested the code.
我还没有测试过代码。
You need to ensure sure you set IsMdiContainer to true on the parent form.
您需要确保在父窗体上将IsMdiContainer设置为true。
Here is the implementation:
这是实施:
Form child = new Form();
Assembly asm = Assembly.LoadFile("c:\\executablefile.exe ");
Type type = asm.GetType("WindowsForm", true, true);
object childform = Activator.CreateInstance(type);
child = (Form)childform;
child.MdiParent = this;
child.Show();