User32VkKeyScanEx Method

Translates a character to the corresponding virtual-key code and shift state.

The function translates the character using the input language and physical keyboard layout identified by the input locale identifier.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("User32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static short VkKeyScanEx(
	char character,
	IntPtr hkl = default
)

Parameters

character  Char
The character to be translated into a virtual-key code.
hkl  IntPtr  (Optional)
Input locale identifier used to translate the character.

This parameter can be any input locale identifier previously returned by the LoadKeyboardLayout function.

Return Value

Int16
If the function succeeds, the low-order byte of the return value contains the virtual-key code, and the high-order byte contains the shift state.

If the function finds no key that translates to the passed character code, both the low-order and high-order bytes contain 255.

Remarks

See Also