我们有一个exe应用程序(VB6)。我们的.NET dll程序集(使用Process.Start)调用了此应用程序,该程序集将用户名和密码作为参数传递给vb6应用程序。VB6应用程序具有仅在执行登录代码后才查找Windows消息的代码。
如果我做的话效果很好:-
情况1:
Process.Start("file.exe", arguments);
Thread.Sleep(1000); //if I comment this line then the msg is never caught by the vb6 app
SendAWindowsMsg("hello");
Run Code Online (Sandbox Code Playgroud)
案例2:
var process = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = @"file.exe",
Arguments = arguments
}
};
process.Start();
process.WaitForInputIdle();
SendAWindowsMsg("hello");
Run Code Online (Sandbox Code Playgroud)
我的问题是:情况1或情况2是更好的方法吗?WaitForInputIdle(什么是输入和空闲的东西?)是什么意思?
小智 5
该WaitForInputIdle功能的目的是让一个进程确定另一个进程(最近启动的进程)是否已达到可以发送该进程消息的状态。
基本上,WaitForInputIdle它询问进程是否完成加载。