Keyboard scan codes (SendInput)

Hi!
I am writing a programm that sends keyboard and mouse input events to another Application using SendInput. This is working well when I use Input.ki.wScan 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
http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/scancode.doc

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:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms646306(v=vs.85).aspx MapVirtualKey()
This gives me the wrong code, too.

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