When launching child processes from applications I used to use GetExitCodeProcess on the process handle, checking if STILL_ACTIVE is returned if it is still running.. heres the smart way!
For instance for threads:
HANDLE hThread;
hThread = CreateThread(NULL,0,StartThread,&threadParam,0,NULL);
if(hThread1 != NULL)
{
WaitForSingleObject(hThread,INFINITE);
}
For processes:
PROCESS_INFORMATION pi={0};
if (CreateProcess (parameters, NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, &pi))
{
WaitForSingleObject(pi.hProcess,INFINITE);
}