Link to home
Start Free TrialLog in
Avatar of marvinm
marvinm

asked on

VK_NUMPAD3

I see that VK_NUMPAD3=99(0x63), which is the same as the letter 'c'.  How do I know which I have received in my WM_KEYDOWN message?  It looks like the HIWORD(lParam)=81 for the numpad 3, and 46 for the 'c', but I cannot find reference as to why.
Thank You
Avatar of AlexVirochovsky
AlexVirochovsky

Use WM_CHAR message. In 2-nd parameter
(lKeyDaya) 24 bit is set, if key is extended (as PAD keys). See more exectly
in description of WM_CHAR in you Windows
Doc.
I hope, it helps. Alex
Avatar of marvinm

ASKER

What is the best way to check the 24 bit?  It looks like I can check this with the WM_KEYDOWN also.
Thank You
Avatar of marvinm

ASKER

using (HIWORD(lParam) & 1) seems to work, but I don't understand why.  The 24 bit should be the 9th bit in the highword.  bits 16-23 are for the scan code which depends on the OEM.  
ASKER CERTIFIED SOLUTION
Avatar of nietod
nietod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Checkin to see if bit 24 down is a bit of a kludge, it works with the numeric pad keys, but it won't work with all keys.  for example, it doesn't work with the regular letter and digit keys to see if a capital letter or a symbol was typed.  You should look at the state of the modifier keys (use GetKeyState()) instead.
Avatar of marvinm

ASKER

VK_C is not defined? I get undeclared identifier when I add it to my switch.
Thank You
It should be defined.  But you can just use 'C' instead.  (not 'c').
Apparently the letter and digits VKs aren't defined.  This comment is from the windows.h include file.

/* VK_0 thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39) */
/* VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A) */
Avatar of marvinm

ASKER

accepting nietod's comment as answer
You are free to award the points to the expert you feel deserves them, but I want to point out that strickly speaking, Alex's answer wasn't wrong, the code he proposed was just a little...weird...patchy.  (Not trying to sound ungrateful.)