XInputSetState

Sends vibration data to the specified two-motor controller.

Syntax

DWORD XInputSetState(  
         DWORD dwUserIndex,  
         const XINPUT_VIBRATION * pVibration  
)  

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.

pVibration   _In_
Type: XINPUT_VIBRATION*

Pointer to an XINPUT_VIBRATION object that contains the vibration information to be sent to the controller.

Return value

Type: DWORD

If the function succeeds, it returns ERROR_SUCCESS.

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

If the function fails, it returns an error code defined in WinError.h.

Remarks

This function supports older controllers which have only two haptic feedback motors. To support additional feedback motors in newer controllers, call XInputSetStateEx.

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