I am using ShellExecuteEx to start an application.
After successful start im reading TShellExecuteInfo.hProcess to obtain a handle of the started process.
I would like to periodically check if the process started by my application is still running.
Two or more processess with the same name can run simultaneously and I want to be sure that my application is checking the correct process.
I want to be able to do this on Windows systems from Windows 2000 to above.
I know that there is WinAPI function GetProcessId which is doing exactly what I want but it does not support Windows 2000.
Thank you for your answers.
Call
WaitForSingleObjecton that handle, and use a timeout parameter of zero. If the process is still running, the function will returnWait_Timeout; if the process has terminated, then it will returnWait_Object_0(because process termination causes its handles to become signaled.)If you want to know what the exit status of the process is, then call
GetExitCodeProcess.