如何知道 Process.Start 何时加载 winform?
我在 WindowsForm (c# .net 3.5) 中,单击按钮使用 Process.Start() 启动另一个外部应用程序(也是 .net 3.5),并在启动它后了解它何时可用。
ProcessStartInfo psInfo = new ProcessStartInfo(@"MyApplication.exe");
psInfo.RedirectStandardOutput = true;
psInfo.RedirectStandardError = true;
psInfo.UseShellExecute = false;
psInfo.CreateNoWindow = true;
Process proc = Process.Start(psInfo);
proc... IsFullyLoaded()?
我该怎么做?
I'm in a WindowsForm (c# .net 3.5) and on click of a button launch another external application (also .net 3.5) using Process.Start() and understand when it is available after i have launched it.
ProcessStartInfo psInfo = new ProcessStartInfo(@"MyApplication.exe");
psInfo.RedirectStandardOutput = true;
psInfo.RedirectStandardError = true;
psInfo.UseShellExecute = false;
psInfo.CreateNoWindow = true;
Process proc = Process.Start(psInfo);
proc... IsFullyLoaded()?
How can i do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要等待进程创建其表单,请调用
WaitForInputIdle
方法。要了解它是否已准备好,请尝试以下操作:
或者,
您也可以使用 MainWindowHandle 属性通过
SendMessage
API函数To wait for the process to create its form, call the
WaitForInputIdle
method.To find out whether it's ready, try this:
Or, alternatively,
You can also use the MainWindowHandle property to send messages to the form using the
SendMessage
API function您可以向进程传递一个参数,让它知道它是如何启动的。
然后让子进程通过远程处理或类似的方式回调所有者进程,让其知道它已经启动。
You could pass an argument to the process letting it know how it was launched.
Then have the child process callback to the owner process to let it know it has started, via remoting or something like that.