Extracting lparam from WM_KEYDOWN MSG
-
I have PretranslateMessage() that checks for WM_KEYDOWN message to capture keystrokes. Then I do my processing from the code it gives me.. int key = (151 + HIWORD (pMsg->lParam) & 0x00ff); All works great, but I want to be able to test it to see if it's a repeat key before processing. That is, if the key is held down, I don't want the repeats to get through. How can I extract lparam bits into a var to see if the message is a repeat key? I beleive 0-15 in lparam tell repeat status. Sorry, I get kinda stumped when I get into working with data on bit and byte level. Thanks...
-
I have PretranslateMessage() that checks for WM_KEYDOWN message to capture keystrokes. Then I do my processing from the code it gives me.. int key = (151 + HIWORD (pMsg->lParam) & 0x00ff); All works great, but I want to be able to test it to see if it's a repeat key before processing. That is, if the key is held down, I don't want the repeats to get through. How can I extract lparam bits into a var to see if the message is a repeat key? I beleive 0-15 in lparam tell repeat status. Sorry, I get kinda stumped when I get into working with data on bit and byte level. Thanks...
Something like this...
WORD wRepeatCount = (WORD)(lParam & 0x0000FFFF);
bool fPreviousKeyStateDown;
if (lParam & 0x40000000)
fPreviousKeyStateDown = true;
else
fPreviousKeyStateDown = false;Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
-
Something like this...
WORD wRepeatCount = (WORD)(lParam & 0x0000FFFF);
bool fPreviousKeyStateDown;
if (lParam & 0x40000000)
fPreviousKeyStateDown = true;
else
fPreviousKeyStateDown = false;Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
Thanks Mark.. your the man. :)
-
Something like this...
WORD wRepeatCount = (WORD)(lParam & 0x0000FFFF);
bool fPreviousKeyStateDown;
if (lParam & 0x40000000)
fPreviousKeyStateDown = true;
else
fPreviousKeyStateDown = false;Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
Great, but how can I get the extended key info (i.e., ALT or CTRL keys) ? Thanks in advance. Mizan