How to check if a given process is running when having its handle How to check if a given process is running when having its handle windows windows

How to check if a given process is running when having its handle


Call WaitForSingleObject on that handle, and use a timeout parameter of zero. If the process is still running, the function will return Wait_Timeout; if the process has terminated, then it will return Wait_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.