Use CreateProcess instead of spawn. Then use hProcess and GetExitCodeProcess api to detect if the process is still running. Check the exit code against STILL_ACTIVE to find out if the process is still running. Another way to check if the process is still running is to call:
Code:BOOL bRunning = ( WaitForSingleObject( hProcess, 0 ) == WAIT_TIMEOUT );


Reply With Quote
Bookmarks