Detecting if a process is still running

后端 未结 4 2051
花落未央
花落未央 2021-01-01 04:01

I need to check if a process with a given HANDLE is still running, I tried to do it using the following code however it always returns at the second return false, even if th

4条回答
  •  温柔的废话
    2021-01-01 04:43

    You can test the process life by using

    bool isProcessRunning(HANDLE process)
    {
       return WaitForSingleObject( process, 0 ) == WAIT_TIMEOUT;
    }
    

提交回复
热议问题