i'm trying to make the screen refresh continuously while still
handling windows messages correctly. here's what i have:

#define MYMSG 19000

PostMessage(hWnd, MYMSG, 0, 0);


while (!bQuit)
{
if (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage (&msg);
DispatchMessage (&msg);
}

}



...


case MYMSG:
boardgraphics.drawboard(board);
SwapBuffers (hDC);
Sleep(10);
PostMessage(hWnd, MYMSG, 0, 0);
return 0;




my understanding is that it should post MYMSG at the end of the queue,
and that it will be read after any keyboard and mouse messages.
however, the window doesn't seem to be handling keyboard and mouse
messages.

any ideas?

Re: message issue by Simon

Simon
Tue Feb 07 06:50:25 CST 2006

<bob@coolgroups.com> wrote in message
news:1139296695.381413.35590@g47g2000cwa.googlegroups.com...
> i'm trying to make the screen refresh continuously while still
> handling windows messages correctly. here's what i have:
>
> case MYMSG:
> boardgraphics.drawboard(board);
> SwapBuffers (hDC);
> Sleep(10);
> PostMessage(hWnd, MYMSG, 0, 0);
> return 0;

Why are you sleeping inside what is (I presume) your main message loop? You
should use ::SetTimer to get WM_TIMER messages for your periodic updates.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/timers/timerreference/timerfunctions/settimer.asp