Win32 API, GetMessage() after PeekMessage()

Started by
1 comment, last by Buckeye 9 years, 9 months ago

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.
Advertisement

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.


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.

You don't forget how to play when you grow old; you grow old when you forget how to play.

This topic is closed to new replies.

Advertisement