Hi all,
I have a little problem (in Windows programming).
I was using "GetMessage()" function for message loop but now when I changed to "PeekMessage()" loop, it occupies 50% of my CPU during the whole program.
Here is the sample code:
After running it, the program takes 50% of my CPU. But when I was using the "GetMessage()" function before, it was OK (at idle, 0% of CPU).Code:while (TRUE) { if (PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE) == TRUE) { // If the message is WM_QUIT, exit the while loop if (Msg.message == WM_QUIT) break; // Translate and dispatch the message TranslateMessage(&Msg); DispatchMessage(&Msg); } }
Does anybody know where is the problem?
Thanks.
Petike



LinkBack URL
About LinkBacks



