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

# XInputGetStateWithToken

> XInputGetStateWithToken

# XInputGetStateWithToken

Retrieves the current state of the specified controller and associates it with a D3DX frame pipeline token.

<a id="syntaxSection" />

## Syntax

```cpp theme={null}
DWORD XInputGetStateWithToken(  
         DWORD dwUserIndex,  
         UINT64 framePipelineToken,  
         XINPUT_STATE * pState  
)  
```

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

*framePipelineToken*   \_In\_\
Type: UINT64

D3DX frame pipeline token.

*pState*   \_Out\_\
Type: [XINPUT\_STATE](/reference/input/xinputongameinput/structs/xinput_state)\*

Pointer to an [XINPUT\_STATE](/reference/input/xinputongameinput/structs/xinput_state) object that receives the current state of 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 is similar to [XInputGetState](/reference/input/xinputongameinput/functions/xinputgetstate), but it associates a specific input reading with a graphics frame for later analysis.

<Note>As of the May Preview release, the behavior of `XInputGetStateWithToken` is identical to that of `XInputGetState`, because the underlying GameInput code is not fully implemented.</Note>

By supplying the frame pipeline token, you can later correlate input API calls with specific graphics frames in the PIX software.

<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

- [XInputGetState](/reference/input/xinputongameinput/functions/xinputgetstate.md)
- [XINPUT_STATE](/reference/input/xinputongameinput/structs/xinput_state.md)
- [Porting from XInput to GameInput](/build/core-features/common/input/porting/input-porting-xinput.md)
- [XInputOnGameInput](/reference/input/xinputongameinput/xinputongameinput_members.md)
- [IGameInputReading::GetGamepadState](/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getgamepadstate.md)
