User32MapVirtualKey Method

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

To specify a handle to the keyboard layout to use for translating the specified code, use the MapVirtualKeyEx(UInt32, VirtualKeyMappingTypes, IntPtr) function.

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 MapVirtualKey(
	uint code,
	VirtualKeyMappingTypes mapType
)

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.

mapType  VirtualKeyMappingTypes
The translation to be performed.

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

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