Freigeben über


XInputGetDeviceId

Retrieves the device ID for the specified controller.

Syntax

DWORD XInputGetDeviceId(  
         DWORD dwUserIndex,  
         APP_LOCAL_DEVICE_ID * pDeviceId  
)  

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.

pDeviceId   _Out_
Type: APP_LOCAL_DEVICE_ID*

ID of the device at the specified user index.

Return value

Type: DWORD

If the function successfully retrieves the device ID, it returns ERROR_SUCCESS.

If the controller is not connected, the function returns ERROR_DEVICE_NOT_CONNECTED.

If the function fails, it returns a Win32 error code.

Remarks

An application-local device ID uniquely identifies a device, even across restarts of the title or the system. For more information, see Device IDs.

For more information about using XInputOnGameInput, 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