> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XInputSetState

> XInputSetState

# XInputSetState

Sends vibration data to the specified two-motor controller.

<a id="syntaxSection" />

## Syntax

```cpp theme={null}
DWORD XInputSetState(  
         DWORD dwUserIndex,  
         const XINPUT_VIBRATION * pVibration  
)  
```

<a id="parametersSection" />

### 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](/reference/input/xinputongameinput/structs/xinput_vibration)\*

Pointer to an [XINPUT\_VIBRATION](/reference/input/xinputongameinput/structs/xinput_vibration) object that contains the vibration information to be sent to the controller.

<a id="retvalSection" />

### 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.

<a id="remarksSection" />

## Remarks

This function supports older controllers which have only two haptic feedback motors. To support additional feedback motors in newer controllers, call [XInputSetStateEx](/reference/input/xinputongameinput/functions/xinputsetstateex).

For more information, see [The XInputOnGameInput wrapper](/build/core-features/common/input/porting/input-porting-xinput#xinputWrapperSection).

<a id="requirementsSection" />

## Requirements

**Header:** XInputOnGameInput.h

**Library:** xgameruntime.lib

**Supported platforms:** XBOX One family consoles and XBOX Series consoles

<a id="seealsoSection" />

## See also

[Porting from XInput to GameInput](/build/core-features/common/input/porting/input-porting-xinput)\
[XInputOnGameInput](/reference/input/xinputongameinput/xinputongameinput_members)


## Related topics

- [XInputSetStateEx](/reference/input/xinputongameinput/functions/xinputsetstateex.md)
- [XInputEnable](/reference/input/xinputongameinput/functions/xinputenable.md)
- [Porting from XInput to GameInput](/build/core-features/common/input/porting/input-porting-xinput.md)
- [XInputOnGameInput](/reference/input/xinputongameinput/xinputongameinput_members.md)
- [XINPUT_VIBRATION_EX](/reference/input/xinputongameinput/structs/xinput_vibration_ex.md)
