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

# XInputGetState

> XInputGetState

# XInputGetState

Recupera o estado atual do controle especificado.

<a id="syntaxSection" />

## Sintaxe

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

<a id="parametersSection" />

### Parâmetros

*dwUserIndex*   \_In\_\
Tipo: DWORD

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

*pState*   \_Out\_\
Tipo: [XINPUT\_STATE](/pt-BR/reference/input/xinputongameinput/structs/xinput_state)\*

Ponteiro para um objeto [XINPUT\_STATE](/pt-BR/reference/input/xinputongameinput/structs/xinput_state) que recebe o estado atual do controle.

<a id="retvalSection" />

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

<a id="remarksSection" />

## Comentários

Essa função relata os gatilhos esquerdo e direito separadamente. No DirectInput, os dois gatilhos compartilhavam o mesmo eixo.

A função [XInputGetStateWithToken](/pt-BR/reference/input/xinputongameinput/functions/xinputgetstatewithtoken) é semelhante, mas permite que o chamador forneça um token de pipeline de quadros D3DX para associar uma leitura de entrada específica a um quadro gráfico para análise posterior no PIX.

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

<a id="requirementsSection" />

## Requisitos

**Cabeçalho:** XInputOnGameInput.h

**Biblioteca:** xgameruntime.lib

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

<a id="seealsoSection" />

## Confira também

[Portabilidade do XInput para o GameInput](/pt-BR/build/core-features/common/input/porting/input-porting-xinput)\
[XInputOnGameInput](/pt-BR/reference/input/xinputongameinput/xinputongameinput_members)


## Related topics

- [XInputGetState](/reference/input/xinputongameinput/functions/xinputgetstate.md)
- [XInputGetStateWithToken](/reference/input/xinputongameinput/functions/xinputgetstatewithtoken.md)
