
Waiting for a process to complete
Quote:
> I've been using the ShellExecute() API to execute a
> process. I currently do a Sleep() to wait for it to
> complete, but it is not accurate. Is there an accurate way
> to know when the process has completed.
You should use "CreateProcess" and wait on the hProcess-Handle in the
PROCESS_INFORMATION-Structure.
CreateProcess(..., &pi);
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
--
Greetings
Jochen