Advertisement

WM_Keydown events for MVC++

Started by August 08, 2000 07:34 AM
5 comments, last by MarkO 24 years, 5 months ago
Using the wParam message the compiler understands the VK_LEFT RIGHT UP DOWN and SPACE commands from my keyboard but the other keys down seem to work. When i went to the MSDN library all the VK keys seemed to be associated with Java only. Any know what the correct messages are for the keyboard or where i can find a list of those.
I don''t know why you should have any trouble. There are virtual key codes for every key on the keyboard no matter what the language. Just check for the WM_KEYDOWN (or other keyboard messages) and as you said, check wparam for the virtual code. I''m looking at a listing of Virtual code constants right now for C++ so they must work.
Advertisement
I have the same problem... All the alphanumeric VK_* constants aren''t there, but they are listed in MSDN! Use ''key'' instead.

if(keys[''R'']) YouPressedR();
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall
hey

You can create your own constants if you like. The keys 0-9 have virtual key codes 0x30 -> 0x39. The keys A-Z have virtual key codes 0x41 -> 0x5A.

ro
I feel so stupid now.. hehe i got caught up in the whole virtual key thing i didnt realize what was really happening behind the scenes. Basically though the wParam is actually just holding the ASCII value for the key pressed then?
I don''t think there is any corelation between ASCII values and virtual key codes (although there may be. I just haven''t bothered to notice). But you can think of the VK codes as ASCII values of a kind.
Advertisement
quote: Original post by MarkO

Basically though the wParam is actually just holding the ASCII value for the key pressed then?


Yeah kinda. Except you get the upper case letters whether shift is pressed or not.

This topic is closed to new replies.

Advertisement