PDA

View Full Version : Waiting for a process


MontyBurns
15th November 2006, 10:21 AM
Hello everybody.

I'm writing an application which starts several other applications (exe and cab files). I want my application to wait for the called process. Can anyone tell me how I can do that?

I've read about an API function called "WaitForInputIdle". But it seems like this function does not exist in User32.dll or even in Windows CE. Do I just have to use another library? If yes which one do I have to invoke?

For now I just check for the called process an set my main thread asleep for one second if the called process is still running. But in my opinion this is not really a nice solution...

Can someone please give me a hint?

Thanks in advance.

Alex

levenum
15th November 2006, 10:37 AM
If you use CreateProcess you get back the handle to that process in the PROCESS_INFORMATION structure.
You can use this handle with WaitForSingleObject API to suspend your thread until the process terminates.

MontyBurns
15th November 2006, 11:22 AM
Hi levenum.

Thanks for this tip. It works fine. :-)