I read:
- How to wait for a process to finish C++
- How to use win32 CreateProcess function to wait until the child done to write to file
Code snippet:
HANDLE hProcess = OpenProcess(SYNCHRONIZE, TRUE, inProcessID);
if (NULL == hProcess)
{
WaitForSingleObject(hProcess,INFINITE);
}
I've tried WaitForSingleObject
and WaitForSingleObjectEx
, neither are actually waiting.
For example assume notepad is running and I want to wait for it to be closed by some user. What shall I do ?