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

# IGameInputDevice::GetDeviceId

> 入力デバイスを一意に識別するアプリケーション ローカル ID を取得します。

入力デバイスを一意に識別するアプリケーション ローカル ID を取得します。

## 構文

```cpp theme={null}
void GetDeviceId(
    APP_LOCAL_DEVICE_ID* deviceId
);
```

### パラメーター

*deviceId*   \_Out\_\
型: [APP\_LOCAL\_DEVICE\_ID](https://docs.xbox.com/ja-jp/reference/system/xuser/structs/app_local_device_id.md)\*

デバイスのアプリケーション ローカル ID を受け取ります。

### 戻り値

型: void

## 解説

デバイス ID はアプリケーション ローカル ID であり、デバイスを一意に識別する 256 ビットのハッシュ値です。この ID は、デバイスが同じ USB ポートに接続されている限り、アプリケーションの実行やシステムの再起動をまたいでも、特定のデバイスに対して同じ値のままです。ハッシュは、呼び出し元のアプリケーションとシステムに固有の情報を一部使用して生成されるため、同じデバイスでもアプリケーションごとに異なる ID になります。

ID は安定しているため、保存しておくことでデバイス (ユーザーが好むコントローラーなど) を記憶しておき、後で [IGameInput::FindDeviceFromId](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinput/methods/igameinput_finddevicefromid.md) を呼び出して一致するデバイス オブジェクトを検索できます。

複合デバイス上の複数のインターフェイスの 1 つであるデバイスについては、[IGameInputDevice::GetDeviceRootId](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getdevicerootid.md) を使用してルート デバイスの ID を取得します。デバイスが複合デバイスの一部でない場合、デバイス ID とルート デバイス ID は同じです。

GameInput v3 以前では、この情報は [IGameInputDevice::GetDeviceInfo](https://docs.xbox.com/ja-jp/reference/input/gameinput/deprecated/interfaces/igameinputdevice/methods/igameinputdevice_getdeviceinfo.md) から返される [GameInputDeviceInfo](https://docs.xbox.com/ja-jp/reference/input/gameinput/deprecated/structs/gameinputdeviceinfo.md) 構造体の `deviceId` メンバーから取得できました。

## 要件

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

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

**サポートされているプラットフォーム:** Windows、XBOX One ファミリー本体、XBOX Series 本体

## 関連項目

[GameInput の概要](https://docs.xbox.com/ja-jp/build/core-features/common/input/overviews/input-overview.md)\
[IGameInputDevice](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md)\
[IGameInputDevice::GetDeviceRootId](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getdevicerootid.md)\
[IGameInput::FindDeviceFromId](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinput/methods/igameinput_finddevicefromid.md)\
[APP\_LOCAL\_DEVICE\_ID](https://docs.xbox.com/ja-jp/reference/system/xuser/structs/app_local_device_id.md)

## バージョン履歴

| バージョン | 変更内容 |
| - | - |
| **v4** | 導入されました。 |


## Related topics

- [IGameInputDevice::GetDeviceRootId](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getdevicerootid.md)
- [IGameInputDevice::IsConnected](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_isconnected.md)
- [IGameInputDevice::GetContainerId](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getcontainerid.md)
- [IGameInputDevice::GetProductId](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getproductid.md)
- [IGameInputDevice::GetVendorId](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getvendorid.md)
