Keyboard scan codes (SendInput)

I am writing a programm that sends keyboard and mouse input events to another Application using SendInput. This is working well when I use scan codes.

How can I find out the scan code for a key?
The code tables Google put me up with had wrong values.

Sorry for my bad english.
Last edited on
Well, there's this document

Keyboard Scan Code Specification document

But when I've used SendInput, I've used the virtual key code instead.
The codes in the linked document don't match my keyboard, neither. At my PC the key 'w' for example is 17 which is 'q' in the specification. I just iterated over all the keys until I found the right one, but this is a messy solution.

I tried virtual key codes first but they never get through to the Application. It's actually a game and I believe D3D manages keypresses.

Is there no function for this? I was hoping there was something like getchar().

edit: MapVirtualKey()
This gives me the wrong code, too.

I definitely need some way to read those codes.
Last edited on
Topic archived. No new replies allowed.