Retrieves a gamepad input event.
DWORD XInputGetKeystroke( DWORD dwUserIndex, DWORD dwFlags, PXINPUT_KEYSTROKE pKeystroke );
Value | Description |
---|---|
XINPUT_FLAG_GAMEPAD | Limit input event fetch to the gamepad. |
XINPUT_FLAG_KEYBOARD | Limit input event fetch to the keyboard. |
XINPUT_FLAG_REMOTE | Limit input event fetch to the infrared remote. |
XINPUT_FLAG_ANYDEVICE | Fetch input event from any device. |
XINPUT_FLAG_ANYUSER | Fetch input event from any device when dwUserIndex is XUSER_INDEX_ANY. |
If the function succeeds, the return value is ERROR_SUCCESS.
If no new keys have been pressed, the return value is ERROR_EMPTY.
If the controller is not connected or the user has not activated it, the return value is ERROR_DEVICE_NOT_CONNECTED. (See Remarks.)
If the function fails, the return value is an error code defined in Winerror.h. The function does not use SetLastError to set the calling thread's last-error code.
Wireless controllers are not considered active upon system startup, and calls to any of the XInput functions before a wireless controller is made active return ERROR_DEVICE_NOT_CONNECTED. Game titles must examine the return code and be prepared to handle this condition. Wired controllers are automatically activated when they are inserted. Wireless controllers are activated when the user presses the START or Xbox Guide button to power on the controller.
The functions XInputGetCapabilities, XInputGetState, and XInputGetKeystroke ignore the port number if XDEVICE_PORT_FLAG_KEYBOARD is specified. If this flag is specified, the same debug keyboard appears to be plugged into all four ports.
Header: Declared in XInput.h.
Import Library: Use Xinput.lib.