Windows Dev Center

XINPUT_KEYSTROKE structure

Specifies keystroke data returned by XInputGetKeystroke.

Syntax


typedef struct _XINPUT_KEYSTROKE {
  WORD  VirtualKey;
  WCHAR Unicode;
  WORD  Flags;
  BYTE  UserIndex;
  BYTE  HidCode;
} XINPUT_KEYSTROKE, *PXINPUT_KEYSTROKE;

Members

VirtualKey

Virtual-key code of the key, button, or stick movement. See XInput.h for a list of valid virtual-key (VK_xxx) codes. Also, see Remarks.

Unicode

This member is unused and the value is zero.

Flags

Flags that indicate the keyboard state at the time of the input event. This member can be any combination of the following flags:

ValueDescription
XINPUT_KEYSTROKE_KEYDOWNThe key was pressed. 
XINPUT_KEYSTROKE_KEYUPThe key was released. 
XINPUT_KEYSTROKE_REPEATA repeat of a held key. 

 

UserIndex

Index of the signed-in gamer associated with the device. Can be a value in the range 0–3.

HidCode

HID code corresponding to the input. If there is no corresponding HID code, this value is zero.

Remarks

Future devices may return HID codes and virtual key values that are not supported on current devices, and are currently undefined. 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 based on keyboard state. The keyboard state at the time a virtual key is pressed modifies the character reported. For example, VK_4 might represent a "4" or a "$", 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 includes information about whether any CTRL, ALT, or SHIFT keys are down.

If the keyboard event represents an Unicode character (for example, pressing the "A" key), the Unicode member will contain that character. Otherwise, Unicode will contain the value zero.

The valid virtual-key (VK_xxx) codes are defined in XInput.h. In addition to codes that indicate key presses, the following codes indicate controller input.

ValueDescription
VK_PAD_AA button 
VK_PAD_BB button 
VK_PAD_XX button 
VK_PAD_YY button 
VK_PAD_RSHOULDERRight shoulder button 
VK_PAD_LSHOULDERLeft shoulder button 
VK_PAD_LTRIGGERLeft trigger 
VK_PAD_RTRIGGERRight trigger 
VK_PAD_DPAD_UPDirectional pad up 
VK_PAD_DPAD_DOWNDirectional pad down 
VK_PAD_DPAD_LEFTDirectional pad left 
VK_PAD_DPAD_RIGHTDirectional pad right 
VK_PAD_STARTSTART button 
VK_PAD_BACKBACK button 
VK_PAD_LTHUMB_PRESSLeft thumbstick click 
VK_PAD_RTHUMB_PRESSRight thumbstick click 
VK_PAD_LTHUMB_UPLeft thumbstick up 
VK_PAD_LTHUMB_DOWNLeft thumbstick down 
VK_PAD_LTHUMB_RIGHTLeft thumbstick right 
VK_PAD_LTHUMB_LEFTLeft thumbstick left 
VK_PAD_LTHUMB_UPLEFTLeft thumbstick up and left 
VK_PAD_LTHUMB_UPRIGHTLeft thumbstick up and right 
VK_PAD_LTHUMB_DOWNRIGHTLeft thumbstick down and right 
VK_PAD_LTHUMB_DOWNLEFTLeft thumbstick down and left 
VK_PAD_RTHUMB_UPRight thumbstick up 
VK_PAD_RTHUMB_DOWNRight thumbstick down 
VK_PAD_RTHUMB_RIGHTRight thumbstick right 
VK_PAD_RTHUMB_LEFTRight thumbstick left 
VK_PAD_RTHUMB_UPLEFTRight thumbstick up and left 
VK_PAD_RTHUMB_UPRIGHTRight thumbstick up and right 
VK_PAD_RTHUMB_DOWNRIGHTRight thumbstick down and right 
VK_PAD_RTHUMB_DOWNLEFTRight thumbstick down and left 

 

Requirements

Header

XInput.h

See also

XInputGetKeystroke

 

 

Community Additions

ADD
Show:
© 2015 Microsoft