You should sometimes (e.g. after reading of 100 data) call a function like this. If you remove the message from the queue, you should dispatch the message. You can call PeekMessage with other filters too (e.g. for a special window or other messages). But the last call should not use any filters! void PeekMessages() { MSG msg; // check for paint-messages ... while ( PeekMessage(&msg, NULL, WM_PAINT, WM_PAINT, PM_REMOVE) ) { // ... and dispatch these TranslateMessage(&msg); DispatchMessage(&msg); } // only to prevent ghost-window on vista! // we dont use the result and let the message // in the queue (PM_NOREMOVE) PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE); }
M
Michael Tharigen
@Michael Tharigen