DirectInput -> Keyboard -> GetDeviceState

Ove Kaaven ovehk at
Fri Feb 22 06:10:52 CST 2002

On Fri, 22 Feb 2002, Arjen Nienhuis wrote:

> The MapVirtualKey in GetDeviceState is not "the way to do it". It does 
> not map VK_?? to DIK_??. I don't know why it does work most of the time.

It works because DIK_* is (at least up to 0x53, as far as I can see)  
identical to the PC keyboard scancodes, and MapVirtualKey handles
scancodes perfectly well. I really don't think this is a coincidence, I
think this is so that Microsoft's DirectInput do *not* need the kind of
mapping table you propose. If there's a problem with the scancode
conversion, you should fix it in MapVirtualKey. I think you may want to
keep in mind that the scancode tables in the keyboard code denote extended
codes with e.g. 0x138 (0x100 + 0x38), while the DIK for that key is 0xB8
(0x80 + 0x38). Perhaps the keyboard scancode tables could be changed to be
compatible with the DIK codes without losing any functionality.

> The correct way to convert the keys is by this table (attachment).
> I made this table by pressing all the keys on my keyboard, and record 
> the keycodes.

Then that table would depend on the keyboard layout (country, language,
etc). It should be enough to keep the keyboard layout table mess in *one*
place in Wine (in the keyboard code, where MapVirtualKey resides), not

More information about the wine-devel mailing list