Jump to content

  • Log In with Google      Sign In   
  • Create Account

Win32 API, GetMessage() after PeekMessage()


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 gasto   Members   -  Reputation: 254

Like
0Likes
Like

Posted 20 July 2014 - 07:57 PM

If PeekMessage() is supposed to do the same thing that GetMessage() does but without waiting for there to be a retriavable message, why would somebody use GetMessage() after PeekMessage() has been called?

while ( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) )
      {
        // Translate and dispatch to WindowProc if not WM_QUIT
        GetMessage( &msg, NULL, 0, 0 );
        TranslateMessage( &msg );
        DispatchMessage( &msg );
      }

Intel Core 2 Quad CPU Q6600, 2.4 GHz. 3GB RAM. ATI Radeon HD 3400.

Sponsor:

#2 bradbobak   Members   -  Reputation: 1148

Like
1Likes
Like

Posted 20 July 2014 - 08:01 PM

afaik, PM_NOREMOVE causes the PeekMessage() to leave the message on the queue. GetMessage() then removes the message from the queue.

 

edit: although this example would probably be fine with just the PeekMessage() without the PM_NOREMOVE.


Edited by bradbobak, 20 July 2014 - 08:25 PM.


#3 Buckeye   Crossbones+   -  Reputation: 6287

Like
0Likes
Like

Posted 20 July 2014 - 08:47 PM


edit: although this example would probably be fine with just the PeekMessage() without the PM_NOREMOVE.

 

Slight correction - add: "...without the GetMessage call."


Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS