User32MapVirtualKeyEx Method

Translates (maps) a virtual-key code into a scan code or character value, or translates a scan code into a virtual-key code.

The function translates the codes using the input language and an 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", CallingConvention = CallingConvention.StdCall, 
	CharSet = CharSet.Unicode, SetLastError = true)]
public static uint MapVirtualKeyEx(
	uint code,
	VirtualKeyMappingTypes mapType,
	IntPtr hkl
)

Parameters

code  UInt32
The virtual-key code or scan code for a key.

How this value is interpreted depends on the value of the mapType parameter.

The high byte of the code value can contain either 0xe0 or 0xe1 to specify the extended scan code.

mapType  VirtualKeyMappingTypes
The translation to be performed.

The value of this parameter depends on the value of the code parameter.

hkl  IntPtr
Input locale identifier to use for translating the specified code.

This parameter can be any input locale identifier returned by the GetKeyboardLayout(UInt32) or LoadKeyboardLayout functions.

Return Value

UInt32
The return value is either a scan code, a virtual-key code, or a character value, depending on the value of code and mapType parameters.

If there is no translation, the return value is 0.

To get extended error information, call GetLastWin32Error.

Remarks

See Also