2
        // Main message loop

        MSG msg;
        ZeroMemory( &msg, sizeof( msg ) );
        while(msg.message!=WM_QUIT)
        {

            if(PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) )
            {
                TranslateMessage( &msg );
                DispatchMessage( &msg );
            }
            else
            {
                Render();
            }
        }

The "render" function hasn't been executing

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • `PeekMessage` will return FALSE only when there is WM_QUIT in message queue. Only that and nothing else. You have to move `Render` function somewhere else, which depends on what it's supposed to do. – Dialecticus Mar 18 '12 at 16:40
  • @Dialecticus No, it returns `FALSE` when the queue is empty. – David Heffernan Mar 18 '12 at 17:15
  • Well, hard to guess what message you keep receiving from the question. I'll put a buck on WM_PAINT, generated over and over again when you don't call Begin/EndPaint(). – Hans Passant Mar 18 '12 at 17:41
  • Ouch, that's no `GetMessage` there. Slow brain, quick fingers... – Dialecticus Mar 18 '12 at 18:39
  • 1
    Debugging tip: Log the messages. See what messages keep coming in and prevent your Render from running. Then see why those messages keep being generated. – Raymond Chen Mar 18 '12 at 19:45

1 Answers1

3

The PeekMessage documentation says this regarding the return value:

If a message is available, the return value is nonzero.

If no messages are available, the return value is zero.

When the message queue is empty, it will indeed return zero, i.e. FALSE. The conclusion therefore is that the message queue is never empty. And the most likely explanation for that is that one of the messages you handle in DispatchMessage leads to that same message being posted to the queue.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490