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.
Namespace: DevCase.Win32.NativeMethodsAssembly: 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
)
<DllImportAttribute("User32.dll", CallingConvention := CallingConvention.StdCall,
CharSet := CharSet.Unicode, SetLastError := true>]
Public Shared Function MapVirtualKey (
code As UInteger,
mapType As VirtualKeyMappingTypes
) As UInteger
Dim code As UInteger
Dim mapType As VirtualKeyMappingTypes
Dim returnValue As UInteger
returnValue = User32.MapVirtualKey(code,
mapType)
public:
[DllImportAttribute(L"User32.dll", CallingConvention = CallingConvention::StdCall,
CharSet = CharSet::Unicode, SetLastError = true)]
static unsigned int MapVirtualKey(
unsigned int code,
VirtualKeyMappingTypes mapType
)
[<DllImportAttribute("User32.dll", CallingConvention = CallingConvention.StdCall,
CharSet = CharSet.Unicode, SetLastError = true)>]
static member MapVirtualKey :
code : uint32 *
mapType : VirtualKeyMappingTypes -> uint32
No code example is currently available or this language may not be supported.
- 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.
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.