Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CreateProcess(...
- WaitForSingleObject(Process.hProcess, INFINITE
- CreateProcess ...
- do {
- Sleep(100);
- Res = WaitForSingleObject(Process.hProcess, 10);
- } while (Res == WAIT_TIMEOUT);
- MSG msg;
- DWORD reason = WAIT_TIMEOUT;
- while (WAIT_OBJECT_0 != reason) {
- reason = MsgWaitForMultipleObjects(1, &hChildProcess, FALSE, INFINITE, QS_ALLINPUT);
- switch (reason) {
- case WAIT_OBJECT_0:
- // Your child process is finished.
- break;
- case (WAIT_OBJECT_0 + 1):
- // A message is available in the message queue.
- if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- // Note that if your main message loop does additional processing
- // (such as calling IsDialogMessage() for modeless dialogs)
- // you will want to do those things here, too.
- }
- break;
- }
- }
Add Comment
Please, Sign In to add comment