There are very few cases when the function is called with non-NULL HWND. The
warning applies only to those.
Then it is time to define it not as a BOOL, but as an int.
That would seem to be the correct solution, but you can bet MS haven't
done that to retain compatibility.
I must admit that I've never noticed this quirk of the return value
from GetMessage before it's been pointed out here, and I bet that
99.99% of Windows applications only treat it as a boolean. I wonder
when the following recommendation was added to the documentation:
"Warning
Because the return value can be nonzero, zero, or -1, avoid code like
this:
while (GetMessage( lpMsg, hWnd, 0, 0)) ...
"
... and why it was documented with such a warning when all examples
have done it that way... for ever.
I note that the MSDN topic "About Messages and Message Queues " also
shows checking the error value, but is blissfully ignorant on what an
"error" might be (especially as it's passing NULL for the window
handle)!
Dave