Guest User

Untitled

a guest
Jan 9th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. MSG msg = {};
  2. bool keepRunning = true;
  3. do
  4. {
  5. while ( ::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) )
  6. {
  7. if ( msg.message == WM_QUIT )
  8. keepRunning = false;
  9. else
  10. {
  11. bool isDlgKey = DlgKeyListener(msg.hwnd, msg.message, msg.wParam, msg.lParam);
  12. if ( ::IsDialogMessage(currDialog, &msg) == FALSE )
  13. {
  14. ::TranslateMessage(&msg);
  15. if ( !isDlgKey )
  16. KeyListener(msg.hwnd, msg.message, msg.wParam, msg.lParam);
  17. ::DispatchMessage(&msg);
  18. }
  19. }
  20. }
  21.  
  22. // if GetTickCount == desired
  23. // do stuff
  24.  
  25. std::this_thread::sleep_for(std::chrono::milliseconds(1)); // Avoid consuming a core
  26. } while ( keepRunning );
Advertisement
Add Comment
Please, Sign In to add comment