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?
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?
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
Regards,
hutch@movsd.com
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.
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.
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?
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..
Just use the state of Shift,Ctrl to select what table you will use XLAT instruction could also be helpfull..
MSDN says to us all:
MapVirtualKey f-n reference on MSDN
You can try this:
to translate from scan-code to virtual-key code
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