> ## 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::GetDeviceRootId

> 取得輸入裝置之根裝置節點的應用程式本機識別碼。

取得輸入裝置之根裝置節點的應用程式本機識別碼。

## 語法

```cpp theme={null}
void GetDeviceRootId(
    APP_LOCAL_DEVICE_ID* deviceRootId
);
```

### 參數

*deviceRootId*   \_Out\_\
類型：[APP\_LOCAL\_DEVICE\_ID](https://docs.xbox.com/zh-TW/reference/system/xuser/structs/app_local_device_id.md)\*

接收根裝置節點的應用程式本機識別碼。

### 傳回值

類型：void

## 備註

根裝置識別碼是應用程式本機識別碼，用來識別複合裝置的根裝置節點。這可讓應用程式推斷個別裝置之間的關係。例如，某些遊戲鍵盤會將自己公開為具有多個鍵盤節點的複合裝置，藉此因應舊版 USB 同時按鍵數最多八個的限制。這些節點會合併成「系統」鍵盤，因此通常對使用者而言是透明的。但在使用 GameInput API 處理個別鍵盤的輸入時，了解這種關係有助於應用程式在將功能對應至按鍵時，避免做出不當的假設 (例如，按鍵一律來自特定裝置)。

回報相同根裝置識別碼的裝置屬於同一個複合裝置。如果裝置不是複合裝置上多個介面之一，則根裝置識別碼會與 [IGameInputDevice::GetDeviceId](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getdeviceid.md) 傳回的識別碼相同。

在 GameInput v3 及更早版本中，此資訊可從 [IGameInputDevice::GetDeviceInfo](https://docs.xbox.com/zh-TW/reference/input/gameinput/deprecated/interfaces/igameinputdevice/methods/igameinputdevice_getdeviceinfo.md) 所傳回 [GameInputDeviceInfo](https://docs.xbox.com/zh-TW/reference/input/gameinput/deprecated/structs/gameinputdeviceinfo.md) 結構的 `deviceRootId` 成員取得。

## 需求

**標頭：** GameInput.h

**程式庫：** gameinput.lib

**支援的平台：** Windows、XBOX One 系列主機和 XBOX Series 主機

## 另請參閱

[GameInput 概觀](https://docs.xbox.com/zh-TW/build/core-features/common/input/overviews/input-overview.md)\
[IGameInputDevice](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md)\
[IGameInputDevice::GetDeviceId](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getdeviceid.md)\
[IGameInputDevice::GetContainerId](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getcontainerid.md)\
[APP\_LOCAL\_DEVICE\_ID](https://docs.xbox.com/zh-TW/reference/system/xuser/structs/app_local_device_id.md)

## 版本歷程記錄

| 版本 | 變更 |
| - | - |
| **v4** | 已推出。 |


## Related topics

- [IGameInputDevice::GetDeviceId](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getdeviceid.md)
- [IGameInputDevice::GetContainerId](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getcontainerid.md)
- [IGameInputDevice (介面內容)](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md)
- [IGameInputDevice::GetVendorId](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getvendorid.md)
- [IGameInputDevice::GetProductId](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getproductid.md)
