ShellExecuteEx doen't wait...
-
I have a thread which launcher another application using ShellExecuteEx(). The problem is, the calling thread is NOT wating till the new Process gets launched. Is there any way to delay the calling thread until ShellExecuteEx() finishes its job? Or is there any other solution for this??? Thanx in advance.
-
I have a thread which launcher another application using ShellExecuteEx(). The problem is, the calling thread is NOT wating till the new Process gets launched. Is there any way to delay the calling thread until ShellExecuteEx() finishes its job? Or is there any other solution for this??? Thanx in advance.
Srini Kella wrote: Is there any way to delay the calling thread until ShellExecuteEx() finishes its job?
WaitForSingleObject() WaitForSingleObjectEx() WaitForMultipleObjects() WaitForMultipleObjectsEx()
Jeremy L. Falcon Homepage : Sonork = 100.16311
"It was a blind man who taught me how to see." - Aerosmith -
Srini Kella wrote: Is there any way to delay the calling thread until ShellExecuteEx() finishes its job?
WaitForSingleObject() WaitForSingleObjectEx() WaitForMultipleObjects() WaitForMultipleObjectsEx()
Jeremy L. Falcon Homepage : Sonork = 100.16311
"It was a blind man who taught me how to see." - AerosmithThe Wait* functions are not going to work because, once the ShellExecute returns, the corresponding new process will already be in non-signalled state. I got a work around: My new process has a got window. So, I delayed the calling thread using EnumWindows() in a loop. EnumWindows() checks for the new window!! ;P Anybody has got a better solution for this, Please!!
-
The Wait* functions are not going to work because, once the ShellExecute returns, the corresponding new process will already be in non-signalled state. I got a work around: My new process has a got window. So, I delayed the calling thread using EnumWindows() in a loop. EnumWindows() checks for the new window!! ;P Anybody has got a better solution for this, Please!!
It will work depending on what you want to do. If you are waiting for the process to finish, then use...
WaitForSingleObject(hProcess, INFINITE); // INFINITE = -1
When the process terminates, it'll return. -1 means it'll wait indefinitely. I thought that's what you wanted, but if you only care about having the window created in the new process then see if this works...WaitForInputIdle(hProcess, INFINITE); // INFINITE = -1
Jeremy L. Falcon Homepage : Sonork = 100.16311
"It was a blind man who taught me how to see." - Aerosmith -
It will work depending on what you want to do. If you are waiting for the process to finish, then use...
WaitForSingleObject(hProcess, INFINITE); // INFINITE = -1
When the process terminates, it'll return. -1 means it'll wait indefinitely. I thought that's what you wanted, but if you only care about having the window created in the new process then see if this works...WaitForInputIdle(hProcess, INFINITE); // INFINITE = -1
Jeremy L. Falcon Homepage : Sonork = 100.16311
"It was a blind man who taught me how to see." - AerosmithI am not waiting for the process to finsih. I am waiting for the process to begin 'fully' instead! Thanks anyway.