User32ToAsciiEx Method
Translates the specified virtual-key code and keyboard state to the corresponding character or characters.
The function translates the code using the input language and physical keyboard layout identified by the input locale identifier.
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", SetLastError = true)]
public static int ToAsciiEx(
uint vkey,
uint scanCode,
byte[] keyState,
ref uint refChar,
uint flags,
IntPtr hkl
)
<DllImportAttribute("User32.dll", SetLastError := true>]
Public Shared Function ToAsciiEx (
vkey As UInteger,
scanCode As UInteger,
keyState As Byte(),
ByRef refChar As UInteger,
flags As UInteger,
hkl As IntPtr
) As Integer
Dim vkey As UInteger
Dim scanCode As UInteger
Dim keyState As Byte()
Dim refChar As UInteger
Dim flags As UInteger
Dim hkl As IntPtr
Dim returnValue As Integer
returnValue = User32.ToAsciiEx(vkey,
scanCode, keyState, refChar, flags,
hkl)
public:
[DllImportAttribute(L"User32.dll", SetLastError = true)]
static int ToAsciiEx(
unsigned int vkey,
unsigned int scanCode,
array<unsigned char>^ keyState,
unsigned int% refChar,
unsigned int flags,
IntPtr hkl
)
[<DllImportAttribute("User32.dll", SetLastError = true)>]
static member ToAsciiEx :
vkey : uint32 *
scanCode : uint32 *
keyState : byte[] *
refChar : uint32 byref *
flags : uint32 *
hkl : IntPtr -> int
No code example is currently available or this language may not be supported.
- vkey UInt32
-
The virtual-key code to be translated
- scanCode UInt32
-
The hardware scan code of the key to be translated.
The high-order bit of this value is set if the key is up (not pressed).
- keyState Byte
-
A pointer to a 256-byte array that contains the current keyboard state.
Each element (byte) in the array contains the state of one key.
If the high-order bit of a byte is set, the key is down (pressed).
The low bit, if set, indicates that the key is toggled on. In this function,
only the toggle bit of the CAPS LOCK key is relevant.
The toggle state of the NUM LOCK and SCROLL LOCK keys is ignored.
- refChar UInt32
-
The buffer that receives the translated character or characters.
- flags UInt32
-
This parameter must be 1 if a menu is active, or 0 otherwise.
- hkl IntPtr
-
Input locale identifier to use to translate the code.
This parameter can be any input locale identifier previously returned by the GetKeyboardLayout(UInt32)
or LoadKeyboardLayout functions.
Int32
If the specified key is a dead key, the return value is negative. Otherwise, it is one of the following values:
0 = The specified virtual key has no translation for the current state of the keyboard.
1 = One character was copied to the buffer
2 = Two characters were copied to the buffer.
This usually happens when a dead-key character (accent or diacritic) stored in the keyboard layout
cannot be composed with the specified virtual key to form a single character