Reputation: 9704
We have an exe application (VB6). This app is called by our .NET dll assembly (using Process.Start
) which passes username and password to the vb6 app as arguments.
The VB6 app has code which looks for windows messages only after login code is executed.
It works well if I do :-
CASE1:
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");
CASE2:
var process = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = @"file.exe",
Arguments = arguments
}
};
process.Start();
process.WaitForInputIdle();
SendAWindowsMsg("hello");
My question is: Will case 1 or case 2 be the better approach? What is the meaning of WaitForInputIdle
(what's the input and idle thing?)?
Upvotes: 4
Views: 12292
Reputation: 161
The purpose of the WaitForInputIdle
function is for a process to determine whether another process (which is recently launched) has reached a state where it is okay to send that process messages.
Basically WaitForInputIdle
it's asking if the process finished loading.
Upvotes: 5