Guest User

Untitled

a guest
Apr 24th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. CreateProcess(...
  2. WaitForSingleObject(Process.hProcess, INFINITE
  3.  
  4. CreateProcess ...
  5. do {
  6. Sleep(100);
  7. Res = WaitForSingleObject(Process.hProcess, 10);
  8. } while (Res == WAIT_TIMEOUT);
  9.  
  10. MSG msg;
  11. DWORD reason = WAIT_TIMEOUT;
  12. while (WAIT_OBJECT_0 != reason) {
  13. reason = MsgWaitForMultipleObjects(1, &hChildProcess, FALSE, INFINITE, QS_ALLINPUT);
  14. switch (reason) {
  15. case WAIT_OBJECT_0:
  16. // Your child process is finished.
  17. break;
  18. case (WAIT_OBJECT_0 + 1):
  19. // A message is available in the message queue.
  20. if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
  21. TranslateMessage(&msg);
  22. DispatchMessage(&msg);
  23. // Note that if your main message loop does additional processing
  24. // (such as calling IsDialogMessage() for modeless dialogs)
  25. // you will want to do those things here, too.
  26. }
  27. break;
  28. }
  29. }
Add Comment
Please, Sign In to add comment