Sign in to follow this  

Win32 API, GetMessage() after PeekMessage()

This topic is 1277 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 );
      }

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites


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

 

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

Share this post


Link to post
Share on other sites
Sign in to follow this