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

# XInputGetDeviceId

> XInputGetDeviceId

# XInputGetDeviceId

指定されたコントローラーのデバイス ID を取得します。

## 構文

```cpp theme={null}
DWORD XInputGetDeviceId(  
         DWORD dwUserIndex,  
         APP_LOCAL_DEVICE_ID * pDeviceId  
)  
```

### パラメーター

*dwUserIndex*   \_In\_\
型: DWORD

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

*pDeviceId*   \_Out\_\
型: APP\_LOCAL\_DEVICE\_ID\*

指定されたユーザー インデックスのデバイスの ID。

### 戻り値

型: DWORD

関数がデバイス ID の取得に成功した場合、`ERROR_SUCCESS` を返します。

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

関数が失敗した場合は、Win32 エラー コードを返します。

## 解説

アプリケーション ローカル デバイス ID は、タイトルやシステムの再起動をまたいでも、デバイスを一意に識別します。詳細については、[デバイス ID](https://docs.xbox.com/ja-jp/build/core-features/common/input/overviews/input-devices.md#deviceIdsSection) を参照してください。

XInputOnGameInput の使用の詳細については、[XInputOnGameInput ラッパー](https://docs.xbox.com/ja-jp/build/core-features/common/input/porting/input-porting-xinput.md#xinputWrapperSection)を参照してください。

## 要件

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

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

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

## 関連項目

[XInput から GameInput への移植](https://docs.xbox.com/ja-jp/build/core-features/common/input/porting/input-porting-xinput.md)\
[XInputOnGameInput](https://docs.xbox.com/ja-jp/reference/input/xinputongameinput/xinputongameinput_members.md)


## Related topics

- [APP_LOCAL_DEVICE_ID](https://docs.xbox.com/ja-jp/reference/system/xuser/structs/app_local_device_id.md)
- [ユーザーと入力デバイス](https://docs.xbox.com/ja-jp/build/core-features/common/user/users-input-devices.md)
- [XInput から GameInput への移植](https://docs.xbox.com/ja-jp/build/core-features/common/input/porting/input-porting-xinput.md)
- [XInputOnGameInput (API の内容)](https://docs.xbox.com/ja-jp/reference/input/xinputongameinput/xinputongameinput_members.md)
- [XInputGetAudioDeviceIds](https://docs.xbox.com/ja-jp/reference/input/xinputongameinput/functions/xinputgetaudiodeviceids.md)
