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

# XInputSetState

> XInputSetState

# XInputSetState

指定した 2 モーター コントローラーにバイブレーション データを送信します。

<a id="syntaxSection" />

## 構文

```cpp theme={null}
DWORD XInputSetState(  
         DWORD dwUserIndex,  
         const XINPUT_VIBRATION * pVibration  
)  
```

<a id="parametersSection" />

### パラメーター

*dwUserIndex*   \_In\_\
型: DWORD

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

*pVibration*   \_In\_\
型: [XINPUT\_VIBRATION](/reference/input/xinputongameinput/structs/xinput_vibration)\*

コントローラーに送信するバイブレーション情報を含む [XINPUT\_VIBRATION](/reference/input/xinputongameinput/structs/xinput_vibration) オブジェクトへのポインター。

<a id="retvalSection" />

### 戻り値

型: DWORD

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

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

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

<a id="remarksSection" />

## 解説

この関数は、ハプティック フィードバック モーターが 2 つしかない古いコントローラーをサポートします。新しいコントローラーの追加のフィードバック モーターをサポートするには、[XInputSetStateEx](/reference/input/xinputongameinput/functions/xinputsetstateex) を呼び出します。

詳細については、[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

- [XInputSetStateEx](/ja-jp/reference/input/xinputongameinput/functions/xinputsetstateex.md)
- [XInputEnable](/ja-jp/reference/input/xinputongameinput/functions/xinputenable.md)
- [XINPUT_VIBRATION_EX](/ja-jp/reference/input/xinputongameinput/structs/xinput_vibration_ex.md)
- [XInput から GameInput への移植](/ja-jp/build/core-features/common/input/porting/input-porting-xinput.md)
- [XINPUT_VIBRATION](/ja-jp/reference/input/xinputongameinput/structs/xinput_vibration.md)
