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
LVL 1
marvinmAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
nietodConnect With a Mentor Commented:
>> 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?
There is no ambiguity.  When you get a VK of 0x63 it is VK_NUMPAD3. If you press the 'c' key you will get a VK_C which is a 'C', not a 'c'.  Note that the VK codes indicate which key has been pressed but are not affected bu the shift/alt/control states.    So if you press '!' which is shift-1, you get a VK code of VK_1.
0
 
AlexVirochovskyCommented:
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
0
 
marvinmAuthor Commented:
What is the best way to check the 24 bit?  It looks like I can check this with the WM_KEYDOWN also.
Thank You
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
marvinmAuthor Commented:
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.  
0
 
nietodCommented:
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.
0
 
marvinmAuthor Commented:
VK_C is not defined? I get undeclared identifier when I add it to my switch.
Thank You
0
 
nietodCommented:
It should be defined.  But you can just use 'C' instead.  (not 'c').
0
 
nietodCommented:
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) */
0
 
marvinmAuthor Commented:
accepting nietod's comment as answer
0
 
nietodCommented:
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.)
0
All Courses

From novice to tech pro — start learning today.