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

# XInputGetState

> XInputGetState

# XInputGetState

Récupère l'état actuel de la manette spécifiée.

## Syntaxe

```cpp theme={null}
DWORD XInputGetState(  
         DWORD dwUserIndex,  
         XINPUT_STATE * pState  
)  
```

### Paramètres

*dwUserIndex*   \_In\_\
Type : DWORD

Index du joueur associé à l'appareil; valeur comprise entre 0 et `XUSER_MAX_COUNT - 1`.

*pState*   \_Out\_\
Type : [XINPUT\_STATE](https://docs.xbox.com/fr-CA/reference/input/xinputongameinput/structs/xinput_state.md)\*

Pointeur vers un objet [XINPUT\_STATE](https://docs.xbox.com/fr-CA/reference/input/xinputongameinput/structs/xinput_state.md) qui reçoit l'état actuel de la manette.

### Valeur de retour

Type : DWORD

Si la fonction réussit, elle retourne `ERROR_SUCCESS`.

Si la manette n'est pas connectée, la fonction retourne `ERROR_DEVICE_NOT_CONNECTED`.

Si la fonction échoue, elle retourne un code d'erreur défini dans WinError.h.

## Remarques

Cette fonction signale séparément les gâchettes gauche et droite. Dans DirectInput, les deux gâchettes partageaient le même axe.

La fonction [XInputGetStateWithToken](https://docs.xbox.com/fr-CA/reference/input/xinputongameinput/functions/xinputgetstatewithtoken.md) est semblable, mais permet à l'appelant de fournir un jeton de pipeline d'images D3DX afin d'associer une lecture d'entrée précise à une image graphique pour une analyse ultérieure dans PIX.

Pour plus d'informations, consultez [Le wrapper XInputOnGameInput](https://docs.xbox.com/fr-CA/build/core-features/common/input/porting/input-porting-xinput.md#xinputWrapperSection).

## Configuration requise

**En-tête :** XInputOnGameInput.h

**Bibliothèque :** xgameruntime.lib

**Plateformes prises en charge :** consoles de la famille XBOX One et consoles XBOX Series

## Voir aussi

[Portage d'XInput vers GameInput](https://docs.xbox.com/fr-CA/build/core-features/common/input/porting/input-porting-xinput.md)\
[XInputOnGameInput](https://docs.xbox.com/fr-CA/reference/input/xinputongameinput/xinputongameinput_members.md)


## Related topics

- [XInputGetStateWithToken](https://docs.xbox.com/fr-CA/reference/input/xinputongameinput/functions/xinputgetstatewithtoken.md)
- [XINPUT_STATE](https://docs.xbox.com/fr-CA/reference/input/xinputongameinput/structs/xinput_state.md)
- [XInputEnable](https://docs.xbox.com/fr-CA/reference/input/xinputongameinput/functions/xinputenable.md)
- [Portage de XInput vers GameInput](https://docs.xbox.com/fr-CA/build/core-features/common/input/porting/input-porting-xinput.md)
- [XInputOnGameInput (contenu de l'API)](https://docs.xbox.com/fr-CA/reference/input/xinputongameinput/xinputongameinput_members.md)
