我目前这样做如下:
// _Container is the panel that the program is to be displayed in.
System.Diagnostics.Process procTest = new System.Diagnostics.Process();
procTest.StartInfo.FileName = "TEST.EXE";
procTest.StartInfo.CreateNoWindow = false;
procTest.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
procTest.Start();
procTest.WaitForInputIdle();
SetParent(procTest.MainWindowHandle, _Container.Handle);
MoveWindow(procTest.MainWindowHandle,
0, 0, _Container.Width, _Container.Height, true);
我在使用此代码时遇到的问题是,一旦我更改 MainWindowHandle(即:按钮缺少文本),应用程序 UI 的某些部分将不再正常工作。
有没有办法做到这一点而不会导致停靠的应用程序出现问题?(通过 .net 或 user32)?