I have two different way to check whether a process is still up and running:
1) using GetExitCodeProcess()
2) walking the list of processes using CreateToolhelp32Snapshot() and checking PIDs
now, in both cases I’m still getting that a process that I terminated with TerminateProcess is till alive even tho it is not.
Is there a way to positively know whether a process is still alive or dead passing the PID?
thanks!
A call to
GetExitCodeProcessshould returnSTILL_ACTIVEfor active processes. After a call toTerminateProcess, the process will be dead, and a different value will be returned.Another way to check if a process is alive is
WaitForSingleObject. If you call this on the process handle with a timeout of 0, it will immediately returnWAIT_TIMEOUTif the process is still running.