From: Frank on
Dear people,

I'm using MapVirtualKey to map virtual keys to actual
key codes. (How) is it possible to select the keyboard
layout, for example, having the function return a key code
90 ("z") for a "German" layout and 88 ("y") for an "English"
layout when the scan code is 21 in both cases?

TIA!
From: David Ching on
"Frank" <jerk(a)gmx.de> wrote in message
news:e867bf59-2c18-4036-b2db-48dee8a649de(a)z35g2000yqd.googlegroups.com...
> Dear people,
>
> I'm using MapVirtualKey to map virtual keys to actual
> key codes. (How) is it possible to select the keyboard
> layout, for example, having the function return a key code
> 90 ("z") for a "German" layout and 88 ("y") for an "English"
> layout when the scan code is 21 in both cases?
>

You are starting with the virtual key and using MapVirtualKey to get its
scan code. I think when you say "key code" you really mean "scan code"? In
any cas, the "z" and "y" have different virtual key codes, that's how they
generate different scan codes.

If you want to start with 'z' or 'y' and get the virtual key or scan code
use VkKeyScan or OemKeyScan. What are you going to do with the virtual
key/scan code once you have it? I need it to use SendInput/keybd_event to
synethesize keystrokes.

-- David

From: Frank on
David Ching wrote:

> You are starting with the virtual key and using MapVirtualKey to get its
> scan code.  I think when you say "key code" you really mean "scan code"?  In
> any cas, the "z" and "y" have different virtual key codes, that's how they
> generate different scan codes.

No I'm starting with the scan code to get the virtual
key - MapVirtualKey works in both directions. By "key code"
I mean the ASCII code of the key, like 90 for "z".

But I found a solution in the meantime by sheer luck ;-)