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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

nietodCommented:
>> 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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.