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

# XInputGetStateWithToken

> XInputGetStateWithToken

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

## Syntax

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

### 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](https://docs.xbox.com/reference/input/xinputongameinput/structs/xinput_state.md)\*

Pointer to an [XINPUT\_STATE](https://docs.xbox.com/reference/input/xinputongameinput/structs/xinput_state.md) object that receives the current state of the controller.

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

## Remarks

This function is similar to [XInputGetState](https://docs.xbox.com/reference/input/xinputongameinput/functions/xinputgetstate.md), 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.

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

## Requirements

**Header:** XInputOnGameInput.h

**Library:** xgameruntime.lib

**Supported platforms:** XBOX One family consoles and XBOX Series consoles

## See also

[Porting from XInput to GameInput](https://docs.xbox.com/build/core-features/common/input/porting/input-porting-xinput.md)\
[XInputOnGameInput](https://docs.xbox.com/reference/input/xinputongameinput/xinputongameinput_members.md)


## Related topics

- [XInputGetState](https://docs.xbox.com/reference/input/xinputongameinput/functions/xinputgetstate.md)
- [XINPUT_STATE](https://docs.xbox.com/reference/input/xinputongameinput/structs/xinput_state.md)
- [Porting from XInput to GameInput](https://docs.xbox.com/build/core-features/common/input/porting/input-porting-xinput.md)
- [XInputOnGameInput (API contents)](https://docs.xbox.com/reference/input/xinputongameinput/xinputongameinput_members.md)
- [IGameInputReading::GetTouchState (Deprecated)](https://docs.xbox.com/reference/input/gameinput/deprecated/interfaces/igameinputreading/methods/igameinputreading_gettouchstate.md)
