Click to See Complete Forum and Search --> : How to determine Process termination??


July 4th, 1999, 03:13 AM
Hi,

How can we know if the Process has terminated ( if created using CreateProcess OR WinExec() functions ).

Thanks,

Ron Daemen
July 4th, 1999, 03:30 AM
Hi,

if you use create CreateProcess :
You can use a structure of type PROCESS_INFORMATION

if (pi.hProcess)
{
DWORD dwExitCode = STILL_ACTIVE;
while (dwExitCode == STILL_ACTIVE)
{
WaitForSingleObject(pi.hProcess, 1000);
GetExitCodeProcess(pi.hProcess, &dwExitCode);
}
}
This while statement will wait and loop untill you process is done.

-- Ron