Skip to main content

XINPUT_KEYSTROKE

Describes keystroke data returned by the XInputGetKeystroke function.

Syntax

Members

VirtualKey
Type: WORD
Virtual-key code of the key, button, or stick movement. Unicode
Type: WCHAR
This member is not used, and its value is zero. Flags
Type: WORD
Flags that indicate the keyboard state at the time of the input event. This member can be any combination of the following flags: UserIndex
Type: BYTE
Index of the gamer associated with the headset; a value in the range of 0 to XUSER_MAX_COUNT - 1. HidCode
Type: BYTE
Human Interface Device (HID) code that corresponds to the input. If there’s no corresponding HID code, this value is zero.

Remarks

This structure is used by the XInputGetKeystroke function. Future devices might return HID codes and virtual-key values that are not supported on current devices and are not defined at this time. Applications should ignore these unexpected values. A virtual-key code is a byte value that represents a particular physical key on the keyboard, not the character or characters (possibly none) that the key can be mapped to according to the keyboard state. The keyboard state at the time a virtual key is pressed modifies the character reported. For example, VK_4 might represent “4” or ”$”, depending on the state of the Shift key. A reported keyboard event includes the virtual key that caused the event, whether the key was pressed or released (or is repeating), and the state of the keyboard at the time of the event. The keyboard state indicates whether any Ctrl, Alt, or Shift keys are pressed. The valid virtual-key codes (VK_xxx) are defined in XInput.h. In addition to codes that indicate key presses, the following codes indicate controller input: For more information, see The XInputOnGameInput wrapper.

Requirements

Header: XInputOnGameInput.h Supported platforms: XBOX One family consoles and XBOX Series consoles

See also

Porting from XInput to GameInput
XInputOnGameInput
Last modified on August 20, 2026