Hi.
How can i convert a scan code to a virtual key code taking into consideration the state of the shift-, ctrl- and alt states?
For example:
scan code 010h maps to 071h, which equals the ASCII letter 'q'. But if Shift is down, this would map to 051h, which, of course, equals 'Q'.
Will i have to do that mapping all on my own for each scan code out there or is there a function which does this for me? MapVirtualKey can't take into consideration the shift, alt, ctrl-states, can it?
Posted on 2002-07-23 03:57:21 by darester
Try GetAsynchKeyState using the WM_KEYDOWN message to trap Ctrl + Shift + key combinations. I thing from memory yopu have to trap the WM_SYSKEYDOWN message to get Alt + combinations.

Regards,

hutch@movsd.com
Posted on 2002-07-23 06:27:10 by hutch--
maybe i didn't explain it correct...
i have several scan codes and i know the states of the shift-, ctrl- and alt-keys for each scan code, at the time it was generated. now i have to generate virtual key codes from this information for all scan codes.
Posted on 2002-07-23 06:39:47 by darester
what i wanna do is write a program in which you can enter a scan code and set the shift-, ctrl- and alt-states and using this information it should convert to a virtual key code. so i'm not reacting to user input (so no WM_KEYDOWN / GetAsyncKeyState). how else can i map that stuff to virtual key codes?
Posted on 2002-07-23 07:20:29 by darester
A simple table will do it...

Just use the state of Shift,Ctrl to select what table you will use XLAT instruction could also be helpfull..
Posted on 2002-07-24 08:04:41 by BogdanOntanu
MSDN says to us all:

The MapVirtualKey function translates (maps) a virtual-key code into a scan code or character value, or translates a scan code into a virtual-key code.


MapVirtualKey f-n reference on MSDN

You can try this:

invoke MapVirtualKey, VK_***, 1

to translate from scan-code to virtual-key code
Posted on 2002-07-24 08:31:13 by Andycar