October 2nd, 2004, 02:44 PM
Processes: How can I wait until a process ends?
Q: How can I wait until a process ends?
A: Depending on the method chosen for creating the process, waiting until it is finished is pretty easy to implement. 'CreateProcess()' provides handles both to the process and its primary thread within the 'PROCESS_INFORMATION' structure. The process handle can be used to wait for termination of the process:
'ShellExecuteEx()' provides only a handle to the process but unfortunately it is not guaranteed and is depending on several options you can set within the 'SHELLEXECUTEINFO' structure. For any other method used to create the process a handle to the process needs to be obtained first.
// Wait until application has terminated
// Close process and thread handles
Last edited by Andreas Masur; July 21st, 2005 at 05:56 PM.
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.