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

# XInputSetState

> XInputSetState

# XInputSetState

Envia dados de vibração para o controle de dois motores especificado.

## Sintaxe

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

### Parâmetros

*dwUserIndex*   \_In\_\
Tipo: DWORD

Índice do jogador associado ao dispositivo; um valor no intervalo de 0 a `XUSER_MAX_COUNT - 1`.

*pVibration*   \_In\_\
Tipo: [XINPUT\_VIBRATION](https://docs.xbox.com/pt-BR/reference/input/xinputongameinput/structs/xinput_vibration.md)\*

Ponteiro para um objeto [XINPUT\_VIBRATION](https://docs.xbox.com/pt-BR/reference/input/xinputongameinput/structs/xinput_vibration.md) que contém as informações de vibração a serem enviadas ao controle.

### Valor retornado

Tipo: DWORD

Se a função for bem-sucedida, ela retornará `ERROR_SUCCESS`.

Se o controle não estiver conectado, a função retornará `ERROR_DEVICE_NOT_CONNECTED`.

Se a função falhar, ela retornará um código de erro definido em WinError.h.

## Comentários

Essa função dá suporte a controles mais antigos que têm apenas dois motores de feedback tátil. Para dar suporte a motores de feedback adicionais em controles mais recentes, chame [XInputSetStateEx](https://docs.xbox.com/pt-BR/reference/input/xinputongameinput/functions/xinputsetstateex.md).

Para obter mais informações, consulte [O wrapper XInputOnGameInput](https://docs.xbox.com/pt-BR/build/core-features/common/input/porting/input-porting-xinput.md#xinputWrapperSection).

## Requisitos

**Cabeçalho:** XInputOnGameInput.h

**Biblioteca:** xgameruntime.lib

**Plataformas com suporte:** consoles da família XBOX One e consoles XBOX Series

## Confira também

[Portabilidade do XInput para o GameInput](https://docs.xbox.com/pt-BR/build/core-features/common/input/porting/input-porting-xinput.md)\
[XInputOnGameInput](https://docs.xbox.com/pt-BR/reference/input/xinputongameinput/xinputongameinput_members.md)


## Related topics

- [XInputSetStateEx](https://docs.xbox.com/pt-BR/reference/input/xinputongameinput/functions/xinputsetstateex.md)
- [XInputEnable](https://docs.xbox.com/pt-BR/reference/input/xinputongameinput/functions/xinputenable.md)
- [Portabilidade do XInput para o GameInput](https://docs.xbox.com/pt-BR/build/core-features/common/input/porting/input-porting-xinput.md)
- [XINPUT_VIBRATION_EX](https://docs.xbox.com/pt-BR/reference/input/xinputongameinput/structs/xinput_vibration_ex.md)
- [XINPUT_VIBRATION](https://docs.xbox.com/pt-BR/reference/input/xinputongameinput/structs/xinput_vibration.md)
