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

# XInputGetDeviceId

> XInputGetDeviceId

# XInputGetDeviceId

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

<a id="syntaxSection" />

## 構文

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

<a id="parametersSection" />

### パラメーター

*dwUserIndex*   \_In\_\
型: DWORD

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

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

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

<a id="retvalSection" />

### 戻り値

型: DWORD

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

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

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

<a id="remarksSection" />

## 解説

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

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

- [APP_LOCAL_DEVICE_ID](/ja-jp/reference/system/xuser/structs/app_local_device_id.md)
- [ユーザーと入力デバイス](/ja-jp/build/core-features/common/user/users-input-devices.md)
- [XInputOnGameInput](/ja-jp/reference/input/xinputongameinput/xinputongameinput_members.md)
- [XInput から GameInput への移植](/ja-jp/build/core-features/common/input/porting/input-porting-xinput.md)
- [IGameInputDevice::GetRawDeviceFeature](/ja-jp/reference/input/gameinput/deprecated/interfaces/igameinputdevice/methods/igameinputdevice_getrawdevicefeature.md)
