I was looking through the Win32 SDK Referance, when I came across this peculiar tidbit:
GetMessage does not remove WM_PAINT messages from the queue. The messages remain in the queue until processed.
Note that the function return value can be TRUE, FALSE, or -1. Thus, you should avoid code like this:
while (GetMessage( lpMsg, hWnd, 0, 0)) ...
The possibility of a -1 return value means that such code can lead to fatal application errors.
Is it just me or does just about every single example of a windows programme use that line of code?