Click to See Complete Forum and Search --> : GetKeyState(): How do I...


EricNielsen
April 29th, 1999, 11:29 AM
How do I interpret the return value from GetKeyState(). In particular I am trapping
for a <Ctrl-C> keyboard entry. I have trapped the WM_DOWNKEY message for
the 'C' part and now I have to look at the 'high-order' bit of the GetKeyState(VK_CONTROL)
return value to see if the <Ctrl> key was also depressed. How do I check the high-order
bit of the return value?

Thanks in advance for any help!

Eric

Paul McKenzie
April 29th, 1999, 01:02 PM
Answer:
GetKeyState(key) & 0x8000;

Reason:
The 0x8000 translates to "1000 0000 0000 0000" in binary. Note that the only "1" is the left-most bit (the high order bit).

Regards,

Paul McKenzie