Sunday 15 July 2012

c - determine if a process is dead or not - by PID -


I have two different ways to check if a process is still running:

1) GetExitCodeProcess () 2) Run the list of processes using CreateToolhelp32 snapshot () and check the PID

Now, in both cases I still find that I am using TerminateProcess A process that has ended with is alive, though it is not.

Is there a way to know positively whether the process is still alive or going through a PID? Thanks!

A call for GetExitCodeProcess back STILL_ACTIVE After calling on TerminateProcess for active processes, the process will die, and a different value will be returned.

Another way to check that a process is alive WaitForSingleObject . If you call it at the time of 0 processing, it will immediately return to WAIT_TIMEOUT if the process is still going on.


No comments:

Post a Comment