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

# XInputSetStateEx

> XInputSetStateEx

# XInputSetStateEx

指定したコントローラーにバイブレーション データを送信します。新しいコントローラーの 4 モーター バイブレーション機能をサポートします。

<a id="syntaxSection" />

## 構文

```cpp theme={null}
DWORD XInputSetStateEx(  
         DWORD dwUserIndex,  
         const XINPUT_VIBRATION_EX * pVibration  
)  
```

<a id="parametersSection" />

### パラメーター

*dwUserIndex*   \_In\_\
型: DWORD

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

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

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

<a id="retvalSection" />

### 戻り値

型: DWORD

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

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

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

<a id="remarksSection" />

## 解説

この関数は、2 モーター コントローラーとの操作中でも安全に呼び出すことができます。2 モーター コントローラー向けに `XInputSetStateEx` に送信されたバイブレーション設定は、送信された入力に対して最良の近似値でコントローラーが振動するように調整されます。このため、[XInputSetState](/reference/input/xinputongameinput/functions/xinputsetstate) を呼び出すような場面では `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

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