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

指定されたコントローラーの現在の状態を取得します。

<a id="syntaxSection" />

## 構文

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

<a id="parametersSection" />

### パラメーター

*dwUserIndex*   \_In\_\
型: DWORD

デバイスに関連付けられているゲーマーのインデックス。0 ～ `XUSER_MAX_COUNT - 1` の範囲の値。

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

コントローラーの現在の状態を受け取る [XINPUT\_STATE](/reference/input/xinputongameinput/structs/xinput_state) オブジェクトへのポインター。

<a id="retvalSection" />

### 戻り値

型: DWORD

関数が成功した場合、`ERROR_SUCCESS` を返します。

コントローラーが接続されていない場合、関数は `ERROR_DEVICE_NOT_CONNECTED` を返します。

関数が失敗した場合は、WinError.h で定義されているエラー コードを返します。

<a id="remarksSection" />

## 解説

この関数は、左トリガーと右トリガーを別々に報告します。DirectInput では、2 つのトリガーは同じ軸を共有していました。

[XInputGetStateWithToken](/reference/input/xinputongameinput/functions/xinputgetstatewithtoken) 関数も同様ですが、呼び出し元は D3DX フレーム パイプライン トークンを指定することで、特定の入力読み取りをグラフィックス フレームに関連付け、後で PIX で分析することができます。

詳細については、[XInputOnGameInput ラッパー](/build/core-features/common/input/porting/input-porting-xinput#xinputWrapperSection)を参照してください。

<a id="requirementsSection" />

## 要件

**ヘッダー:** XInputOnGameInput.h

**ライブラリ:** xgameruntime.lib

**対応プラットフォーム:** XBOX One ファミリー本体および XBOX Series 本体

<a id="seealsoSection" />

## 関連項目

[XInput から GameInput への移植](/build/core-features/common/input/porting/input-porting-xinput)\
[XInputOnGameInput](/reference/input/xinputongameinput/xinputongameinput_members)


## Related topics

- [XInputGetStateWithToken](/ja-jp/reference/input/xinputongameinput/functions/xinputgetstatewithtoken.md)
- [XInputEnable](/ja-jp/reference/input/xinputongameinput/functions/xinputenable.md)
- [XINPUT_STATE](/ja-jp/reference/input/xinputongameinput/structs/xinput_state.md)
- [XInput から GameInput への移植](/ja-jp/build/core-features/common/input/porting/input-porting-xinput.md)
- [XInputOnGameInput](/ja-jp/reference/input/xinputongameinput/xinputongameinput_members.md)
