Compartir a través de


XInputGetCapabilities

Retrieves the capabilities and features of a connected controller.

Syntax

DWORD XInputGetCapabilities(  
         DWORD dwUserIndex,  
         DWORD dwFlags,  
         XINPUT_CAPABILITIES * pCapabilities  
)  

Parameters

dwUserIndex   _In_
Type: DWORD

Index of the gamer associated with the device; a value in the range of 0 to XUSER_MAX_COUNT - 1.

dwFlags   _In_
Type: DWORD

Input flags that identify the controller type. If this value is 0, the capabilities of all controllers connected to the system are returned. Currently, only XINPUT_FLAG_GAMEPAD is supported.

pCapabilities   _Out_
Type: XINPUT_CAPABILITIES*

Pointer to an XINPUT_CAPABILITIES object that receives the controller capabilities.

Return value

Type: DWORD

If the function succeeds, the return value is ERROR_SUCCESS.

If the controller is not connected, the return value is ERROR_DEVICE_NOT_CONNECTED.

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.

Remarks

Note

The legacy XINPUT 9.1.0 version (included in Windows Vista and later) always returned a fixed set of capabilities regardless of attached device.

For details about reported capabilities, see XINPUT_CAPABILITIES.

For more information, see The XInputOnGameInput wrapper.

Requirements

Header: XInputOnGameInput.h

Library: xgameruntime.lib

Supported platforms: Xbox One family consoles and Xbox Series consoles

See also

Porting from XInput to GameInput
XInputOnGameInput