Programming Tips - How can I tell if a process is running?
Q. How can I tell if a process is running?
A. By attempting to get the exit code, like this:
BOOL IsProcessRunning(const HANDLE hProcess)
if (!GetExitCodeProcess(hProcess, &dwExitCode)) return FALSE;
return dwExitCode == STILL_ACTIVE;
printf("My process IS running\n");
printf("My process is NOT running\n");
If you just want to wait until a process is done it is better to do: