vk keys... please help
well im having a bit of a problem.. i know basically how they work.
but how do i get the value for keys such as the './>' key or the '`/~' key?!? they arnt in the lists that i find.
as well how can i tell the difference between 'a' and 'A' using vk keys?
the reason i ask is that im using nehes basecode and use keydown to check for the key.. but i cant detect if certain keys are pressed.. is this a limitation? or is there a way to get the key pressed in ascii form? i dont know
thanks for the help
later
Edited by - akudoi on September 18, 2001 7:07:09 PM
Lowercase and uppercase letters use the same keys, hence they have the same keycode. Check if caps lock is on, then not that test if the shift key is down. If the end result is true, then the letter should be capital.
[Resist Windows XP''s Invasive Production Activation Technology!]
[Resist Windows XP''s Invasive Production Activation Technology!]
September 18, 2001 06:30 PM
thanks. 
that helps with the case problem.. now is there a way to find out if the . key or the ~ key or even / key is pressed? there ascii code doesnt work with vk key codes

that helps with the case problem.. now is there a way to find out if the . key or the ~ key or even / key is pressed? there ascii code doesnt work with vk key codes
Try to avoid relying on ascii codes for input if you intend to use the input for something other than inputting text (such as moving a character in a game etc.) because not all keyboards have the same ascii-characters on the same keys (international keyboards etc).
Conversely, when the input is to be used as text (such as entering a name), don''t rely on keycodes/scancodes and assume that you know which ascii character a key represents. Instead use the operating systems standard way of translating scancodes into ascii (or unicode, whatever...). That way people with international keyboards, or e.g. (softcoded) Dvorak layout keyboards will get the character they expect when they press a key, instead of getting the character that you, as developer, expects a key to represent.
There are some useful Windows functions that do exactly this. I don''t remember their names, but search the docs.
Conversely, when the input is to be used as text (such as entering a name), don''t rely on keycodes/scancodes and assume that you know which ascii character a key represents. Instead use the operating systems standard way of translating scancodes into ascii (or unicode, whatever...). That way people with international keyboards, or e.g. (softcoded) Dvorak layout keyboards will get the character they expect when they press a key, instead of getting the character that you, as developer, expects a key to represent.
There are some useful Windows functions that do exactly this. I don''t remember their names, but search the docs.
thanks Dactylos. that helped me. and i got it all working now..
rudy.. thanks.. if i knew i was gonna get told off for asking a question and trying to learn. then maybe ill just stay away from the forms.. geez. i thought these forms were for helping ppl. i guess not.
to thoese that do try to help.. thx
rudy.. thanks.. if i knew i was gonna get told off for asking a question and trying to learn. then maybe ill just stay away from the forms.. geez. i thought these forms were for helping ppl. i guess not.
to thoese that do try to help.. thx
Don''t worry about rudy, all he does is attempt to start flame wars.
[Resist Windows XP''s Invasive Production Activation Technology!]
[Resist Windows XP''s Invasive Production Activation Technology!]
np its all good! i usually just ignore thoese ppl.. i was just a little thrown off cause it was just a "in your face" deal.
well i have the whole case thing down.. im still having problems with the keys though.. there is no VK_ key for the peroid and \ i checked msdn and searched the net.. they have VK_PERIOD but its for java.
how can i get them? eg, ` how would i check if its down?
here is the code im using. well snippets
thx
well i have the whole case thing down.. im still having problems with the keys though.. there is no VK_ key for the peroid and \ i checked msdn and searched the net.. they have VK_PERIOD but its for java.
how can i get them? eg, ` how would i check if its down?
here is the code im using. well snippets
|
thx
The tilde key has a wparam of 0xC0. I suggest you write an application to give you a message box whenever a key is presses with all of that key''s information. It''s pretty useful
.
[Resist Windows XP''s Invasive Production Activation Technology!]

[Resist Windows XP''s Invasive Production Activation Technology!]
I''m not sure how the IDE in C++ works, but from VB, it is quite easy to get a drop down list of all the DIK_ things or whatnot, so looking through, I''ve found:
DIK_PERIOD
As for the ~/` key... does anyone know what the ` is, because my guess is that it is DIK_BLAH... DIK_TILDE doesn''t exist, so I know it isn''t that
(a ~ is a tilde right?)... if it is a grave, then the code is DIK_GRAVE
.
Possibly you could try just outputting the keycode of a pressed to the screen and making your own #DEFINE or however you do it.
Actually, I''ve just had a brainstorm... yep, it is DIK_GRAVE... in the DX8 VB SDK there is a program which will output the DIK name of whatever keys are down. So anyway, I''ll leave you with a fairly long snippet of VB code, which is easy to convert to C++ which will take a keycode and output the actual DIK constant:
Sorry about the length of that, but it is pretty useful and I''m not sure if it is in the C++ SDK.
Trying is the first step towards failure.
DIK_PERIOD
As for the ~/` key... does anyone know what the ` is, because my guess is that it is DIK_BLAH... DIK_TILDE doesn''t exist, so I know it isn''t that


Possibly you could try just outputting the keycode of a pressed to the screen and making your own #DEFINE or however you do it.
Actually, I''ve just had a brainstorm... yep, it is DIK_GRAVE... in the DX8 VB SDK there is a program which will output the DIK name of whatever keys are down. So anyway, I''ll leave you with a fairly long snippet of VB code, which is easy to convert to C++ which will take a keycode and output the actual DIK constant:
quote:
aKeys(1) = "DIK_ESCAPE"
aKeys(2) = "DIK_1 On main keyboard"
aKeys(3) = "DIK_2 On main keyboard"
aKeys(4) = "DIK_3 On main keyboard"
aKeys(5) = "DIK_4 On main keyboard"
aKeys(6) = "DIK_5 On main keyboard"
aKeys(7) = "DIK_6 On main keyboard"
aKeys(8) = "DIK_7 On main keyboard"
aKeys(9) = "DIK_8 On main keyboard"
aKeys(10) = "DIK_9 On main keyboard"
aKeys(11) = "DIK_0 On main keyboard"
aKeys(12) = "DIK_MINUS On main keyboard"
aKeys(13) = "DIK_EQUALS On main keyboard"
aKeys(14) = "DIK_BACK BACKSPACE"
aKeys(15) = "DIK_TAB"
aKeys(16) = "DIK_Q"
aKeys(17) = "DIK_W"
aKeys(18) = "DIK_E"
aKeys(19) = "DIK_R"
aKeys(20) = "DIK_T"
aKeys(21) = "DIK_Y"
aKeys(22) = "DIK_U"
aKeys(23) = "DIK_I"
aKeys(24) = "DIK_O"
aKeys(25) = "DIK_P"
aKeys(26) = "DIK_LBRACKET ["
aKeys(27) = "DIK_RBRACKET ]"
aKeys(28) = "DIK_RETURN ENTER on main keyboard"
aKeys(29) = "DIK_LCONTROL Left CTRL Key"
aKeys(30) = "DIK_A"
aKeys(31) = "DIK_S"
aKeys(32) = "DIK_D"
aKeys(33) = "DIK_F"
aKeys(34) = "DIK_G"
aKeys(35) = "DIK_H"
aKeys(36) = "DIK_J"
aKeys(37) = "DIK_K"
aKeys(38) = "DIK_L"
aKeys(39) = "DIK_SEMICOLON"
aKeys(40) = "DIK_APOSTROPHE"
aKeys(41) = "DIK_GRAVE Grave accent (`)"
aKeys(42) = "DIK_LSHIFT Left SHIFT"
aKeys(43) = "DIK_BACKSLASH"
aKeys(44) = "DIK_Z"
aKeys(45) = "DIK_X"
aKeys(46) = "DIK_C"
aKeys(47) = "DIK_V"
aKeys(48) = "DIK_B"
aKeys(49) = "DIK_N"
aKeys(50) = "DIK_M"
aKeys(51) = "DIK_COMMA"
aKeys(52) = "DIK_PERIOD On main keyboard"
aKeys(53) = "DIK_SLASH Forward slash (/)on main keyboard"
aKeys(54) = "DIK_RSHIFT Right SHIFT"
aKeys(55) = "DIK_MULTIPLY Asterisk on numeric keypad"
aKeys(56) = "DIK_LMENU Left ALT"
aKeys(57) = "DIK_SPACE Spacebar"
aKeys(58) = "DIK_CAPITAL CAPS LOCK"
aKeys(59) = "DIK_F1"
aKeys(60) = "DIK_F2"
aKeys(61) = "DIK_F3"
aKeys(62) = "DIK_F4"
aKeys(63) = "DIK_F5"
aKeys(64) = "DIK_F6"
aKeys(65) = "DIK_F7"
aKeys(66) = "DIK_F8"
aKeys(67) = "DIK_F9"
aKeys(68) = "DIK_F10"
aKeys(69) = "vDIK_NUMLOCK"
aKeys(70) = "DIK_SCROLL SCROLL LOCK"
aKeys(71) = "DIK_NUMPAD7"
aKeys(72) = "DIK_NUMPAD8"
aKeys(73) = "DIK_NUMPAD9"
aKeys(74) = "DIK_SUBTRACT Hyphen (minus sign) on numeric keypad"
aKeys(75) = "DIK_NUMPAD4"
aKeys(76) = "DIK_NUMPAD5"
aKeys(77) = "DIK_NUMPAD6"
aKeys(78) = "DIK_ADD Plus sign on numeric keypad"
aKeys(79) = "DIK_NUMPAD1"
aKeys(80) = "DIK_NUMPAD2"
aKeys(81) = "DIK_NUMPAD3"
aKeys(82) = "DIK_NUMPAD0"
aKeys(83) = "DIK_DECIMAL Period (decimal point) on numeric keypad"
aKeys(87) = "DIK_F11"
aKeys(88) = "DIK_F12"
aKeys(86) = "DIK_F13"
aKeys(84) = "DIK_F14"
aKeys(85) = "DIK_F15"
aKeys(156) = "DIK_NUMPADENTER"
aKeys(157) = "DIK_RCONTROL Right CTRL key"
aKeys(91) = "DIK_NUMPADCOMMA Comma on NEC PC98 numeric keypad"
aKeys(181) = "DIK_DIVIDE Forward slash (/)on numeric keypad"
aKeys(183) = "DIK_SYSRQ"
aKeys(184) = "DIK_RMENU Right ALT"
aKeys(199) = "DIK_HOME"
aKeys(200) = "DIK_UP Up arrow"
aKeys(201) = "DIK_PRIOR PAGE UP"
aKeys(203) = "DIK_LEFT Left arrow"
aKeys(205) = "DIK_RIGHT Right arrow"
aKeys(207) = "DIK_END"
aKeys(208) = "DIK_DOWN Down arrow"
aKeys(209) = "DIK_NEXT PAGE DOWN"
aKeys(210) = "DIK_INSERT"
aKeys(211) = "DIK_DELETE"
aKeys(219) = "DIK_LWIN Left Windows key"
aKeys(220) = "DIK_RWIN Right Windows key"
aKeys(221) = "DIK_APPS Application key"
aKeys(116) = "DIK_PAUSE"
Sorry about the length of that, but it is pretty useful and I''m not sure if it is in the C++ SDK.
Trying is the first step towards failure.
Trying is the first step towards failure.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement