Advertisement

VK_TILDE???

Started by August 24, 2000 09:29 PM
11 comments, last by wise_Guy 24 years, 4 months ago
Hmm maybe you can explain something that has been confusing me
i have a simple DX windows program i am using to test and try out various graphics functions while learning DX
In windproc i am using the WM_Keydown (wparam) messages to use different keys on my keyboard to run various functions for testing purpuoses
Having said all that i test for the ascii codes listed in the MSDN for say Capital ''A'' but the loop executes when i type upper or lowercase ''a''...any ideas why this should be?
Like, I said... The KeyDown doesn''t check for actual ASCII values... Instead, it uses a symbolic value for each key, ''A'' for the a key, VK_RETURN for enter, and so on...

You could however make a seperate check to see if the user presses the shift key (VK_SHIFT), and the a key, add those together by using a flag or something... (you''ll have to use KeyUp to determine when the user has stopped pressing shift)

I''m sure there are better ways... though.
AquDev - It is what it is.
Advertisement
The characters given by the WM_KEYDOWN are virtual keycodes...

The idea behind virtualising the keycodes is to make any differences between hardware transparent to the programmer - any correlation with actual ASCII values could be considered coincidental.

So, use ''MapVirtualKey()'' to get hardware scan codes and ''ToAscii()'' to get the ascii value of the virtual key code (or ''ToUnicode()'' if you''re that way inclined).

The simplest way to pick up ''Alt-XXX'' commands is to process the WM_SYSKEYUP and WM_SYSKEYDOWN messages. Though I prefer to use ''GetAsyncKeyState()''.

Jansic.


-----------------
Janucybermetaltvgothmogbunny

This topic is closed to new replies.

Advertisement