KeybdDriverVKeyToUnicode

This function generates the appropriate Unicode characters and SHIFT state flags for a specified virtual-key code, key state array, and driver state.

UINT32 KeybdDriverVKeyToUnicode(
  UINT32 VirtualKey,
  KEY_STATE_FLAGS KeyEvent,
  KEY_STATE KeyState,
  void* pKeybdDriverToUnicodeState,
  UINT32 cBufferSize,
  UINT32* pcCharacters,
  KEY_STATE_FLAGS* pShiftStateBuffer,
  UINT32* pCharacterBuffer 
);

Parameters

  • VirtualKey
    [in] Virtual-key code that causes the event.
  • KeyEvent
    [in] KeyStateDownFlag flag that is set or cleared.
  • KeyState
    [in] Key state.
  • pKeybdDriverToUnicodeState
    [in] Driver-specific TO_UNICODE_STATE.
  • cBufferSize
    [in] Count of 32-bit entries in each buffer.
  • pcCharacters
    [out] Pointer to a count of characters generated.
  • pShiftStateBuffer
    [out] Pointer to a buffer to put the SHIFT state information.
  • pCharacterBuffer
    [out] Pointer to a buffer to put the characters.

Return Values

Windows–based desktop platforms error code.

Remarks

This function must be re-entrant, because the input system exposes it through the MapVirtualKey function and multiple threads can call it.

Converts a virtual-key code to Unicode and updates the system KeyState.

Within the Layout Manager, this function also performs ALT + numeric keypad logic. Pressing ALT in conjunction with certain numeric keypad keys inputs a special character. If dead keys are used, it may return up to two characters.

If KeyState is NULL, the driver must fill in the character corresponding to the unshifted state for the virtual-key code and return.

In all other cases, the KeybdDriverVKeyToUnicode function must update the key state array, fill in the SHIFT state determined from the key state array, and, if necessary, update TO_UNICODE_STATE. This means that the count of characters generated is always at least 1, because the SHIFT state is always returned. For information about generating the SHIFT state without a corresponding character, see KEY_STATE_FLAGS.

Each character should have a corresponding SHIFT state entered into the SHIFT state buffer, even if it is the same as the preceding SHIFT state.

Each entry in the character buffer is 32 bits, whereas a Unicode character is 16 bits. The driver assigns characters to the buffer to clear the high-order 16 bits.

Requirements

OS Versions: Windows CE 1.0 and later.
Header: Keybddr.h.
Link Library: LayoutManager.lib.

See Also

KeybdDriverGetInfo | KeybdDriverInitStates | KEY_STATE_FLAGS | MapVirtualKey | Keyboard Drivers

 Last updated on Tuesday, May 18, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.