Strange: GetMessage keeps returning message
Hi There,
The following codes keeps returning messages even nothing is preesed in the keyboard and mouse is not moved and touched.
Code:
while ( bRet = GetMessage (&msg, NULL, 0, 0))
{
bRet = TranslateMessage (&msg) ;
if (0 == bRet)
MessageBox (NULL, TEXT ("Error: GetMessage return 0!"),
szAppName, MB_ICONERROR) ;
DispatchMessage (&msg) ;
}
Three returns are:
Code:
meg 1st 2nd 3rd
hwnd 0x00000000 0x00000000 0x00000000
message 49368 49368 49368
wParam 17 17 17
lParam 657624 854138 1050746
time 143047484 143249515 143362468
pt {x=830 y=237} {x=653 y=563} {x=611 y=561}
For these messages, TranslateMessage returns 0.
The OS is Windows 2000 with Service pack 4 or Windows XP with service pack 2.
What're these message? Where are they from?
Note about TranslateMessage Return Value
If the message is translated (that is, a character message is posted to the thread's message queue), the return value is nonzero.
If the message is WM_KEYDOWN, WM_KEYUP, WM_SYSKEYDOWN, or WM_SYSKEYUP, the return value is nonzero, regardless of the translation.
If the message is not translated (that is, a character message is not posted to the thread's message queue), the return value is zero.
Thanks,