Share via


PFN_KEYBD_DRIVER_VKEY_TO_UNICODE

Other versions of this page are also available for the following:

Windows Mobile SupportedWindows Embedded CE Supported

8/28/2008

The function based on this prototype generates the appropriate Unicode characters and SHIFT state flags for a specified virtual-key code, key state array, and driver state.

Syntax

typedef UINT32 (*PFN_KEYBD_DRIVER_VKEY_TO_UNICODE)(
  UINT32 VKey,
  KEY_STATE_FLAGS KeyEventFlags,
  KEY_STATE KeyState,
  void *KeybdDriverState,
  UINT32 cBufferSize,
  UINT32 *pcCharacters,
  KEY_STATE_FLAGS *pShiftStateBuffer,
  UINT32 *pCharacterBuffer
);

Parameters

  • VKey
    [in] Virtual-key code that causes the event.
  • KeyEventFlags
    [in] KeyStateDownFlag flag that is set or cleared.
  • KeyState
    [in] Key state.
  • KeybdDriverState
    [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 Value

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.

This function converts a virtual-key code to Unicode and updates the system KeyState. Within Layout Manager, it 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 might 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

Header keybddr.h
Library layoutmanager.lib
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

KEY_STATE_FLAGS
PFN_KEYBD_DRIVER_GET_INFO
PFN_KEYBD_DRIVER_INIT_STATES

Other Resources

MapVirtualKey