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

# XInputSetStateEx

> XInputSetStateEx

# XInputSetStateEx

Envía datos de vibración al mando especificado. Admite la funcionalidad de vibración de cuatro motores de los mandos más recientes.

## Sintaxis

```cpp theme={null}
DWORD XInputSetStateEx(  
         DWORD dwUserIndex,  
         const XINPUT_VIBRATION_EX * pVibration  
)  
```

### Parámetros

*dwUserIndex*   \_In\_\
Tipo: DWORD

Índice del jugador asociado al dispositivo; un valor en el intervalo de 0 a `XUSER_MAX_COUNT - 1`.

*pVibration*   \_In\_\
Tipo: [XINPUT\_VIBRATION\_EX](https://docs.xbox.com/es/reference/input/xinputongameinput/structs/xinput_vibration_ex.md)\*

Puntero a un objeto [XINPUT\_VIBRATION\_EX](https://docs.xbox.com/es/reference/input/xinputongameinput/structs/xinput_vibration_ex.md) que contiene la información de vibración que se enviará al mando.

### Valor devuelto

Tipo: DWORD

Si la función se ejecuta correctamente, devuelve `ERROR_SUCCESS`.

Si el mando no está conectado, la función devuelve `ERROR_DEVICE_NOT_CONNECTED`.

Si la función da error, devuelve un código de error definido en WinError.h.

## Comentarios

Llamar a esta función es seguro incluso durante una interacción con un mando de dos motores. Cualquier configuración de vibración enviada a `XInputSetStateEx` para un mando de dos motores se ajustará para garantizar que el mando siga vibrando con la mejor aproximación posible a la entrada enviada. Por este motivo, se recomienda llamar a `XInputSetStateEx` en las situaciones en las que llamaría a [XInputSetState](https://docs.xbox.com/es/reference/input/xinputongameinput/functions/xinputsetstate.md).

Para obtener más información, consulte [El contenedor XInputOnGameInput](https://docs.xbox.com/es/build/core-features/common/input/porting/input-porting-xinput.md#xinputWrapperSection).

## Requisitos

**Encabezado:** XInputOnGameInput.h

**Biblioteca:** xgameruntime.lib

**Plataformas compatibles:** consolas de la familia XBOX One y consolas XBOX Series

## Consulte también

[Portabilidad de XInput a GameInput](https://docs.xbox.com/es/build/core-features/common/input/porting/input-porting-xinput.md)\
[XInputOnGameInput](https://docs.xbox.com/es/reference/input/xinputongameinput/xinputongameinput_members.md)


## Related topics

- [XInputSetState](https://docs.xbox.com/es/reference/input/xinputongameinput/functions/xinputsetstate.md)
- [XINPUT_VIBRATION_EX](https://docs.xbox.com/es/reference/input/xinputongameinput/structs/xinput_vibration_ex.md)
- [XINPUT_VIBRATION](https://docs.xbox.com/es/reference/input/xinputongameinput/structs/xinput_vibration.md)
- [XInputOnGameInput (contenido de la API)](https://docs.xbox.com/es/reference/input/xinputongameinput/xinputongameinput_members.md)
- [Portabilidad de XInput a GameInput](https://docs.xbox.com/es/build/core-features/common/input/porting/input-porting-xinput.md)
