| ylxin1993 (73) | |||||||
first I handle the message loop like this:
after I learn the double buffering, handle like this:
I'm wondering why in the double buffering don't use GetMessage() function, can
| |||||||
|
|
|||||||
| guestgulkan (2830) | |
|
The real difference here is between the PeekMessage and the GetMessage function behaviour When GetMessage checks the message queue, if there are no messages it waits for a message to become available. When PeekMessage checks the queue, if there is a message available then PeekMessage returns it, if there is no message available then PeekMessage returns anyway. So GetMessage will always return with a message even if it has to wait for a long long time. PeekMessage does not wait if there is no message available in the queue - it will return with or without a message. So with PeekMessage you need to check if it got a message using if(PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) //check if PeekMessage found a message in the queue I could go on... but I will point you to this link:(Using Messages and Message Queues) http://msdn.microsoft.com/en-gb/library/windows/desktop/ms644928%28v=vs.85%29.aspx | |
|
|
|