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

> 获取输入设备的根设备节点的应用本地 ID。

获取输入设备的根设备节点的应用本地 ID。

## 语法

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

### 参数

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

接收根设备节点的应用本地 ID。

### 返回值

类型：void

## 备注

根设备 ID 是一个应用本地 ID，用于标识组合设备的根设备节点。这允许应用推断各个设备之间的关系。例如，一些游戏键盘通过将自己作为具有多个键盘节点的组合设备来暴露，从而绕过了 8 个同时按键的旧版 USB 限制。这些节点会被合并到“系统”键盘中，因此这一细节对用户通常是透明的。但是当通过 GameInput API 处理每个键盘的输入时，了解这种关系可以帮助应用在将功能映射到按键时避免做出不合理的假设（例如，假设按键始终来自特定设备）。

报告相同根设备 ID 的设备属于同一个组合设备。如果设备不是组合设备上的多个接口之一，则根设备 ID 与 [IGameInputDevice::GetDeviceId](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getdeviceid.md) 返回的 ID 相同。

在 GameInput v3 及更早版本中，此信息可从 [IGameInputDevice::GetDeviceInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/deprecated/interfaces/igameinputdevice/methods/igameinputdevice_getdeviceinfo.md) 返回的 [GameInputDeviceInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/deprecated/structs/gameinputdeviceinfo.md) 结构的 `deviceRootId` 成员中获取。

## 要求

**头文件：** GameInput.h

**库：** gameinput.lib

**支持的平台：** Windows、XBOX One 系列主机和 XBOX Series 主机

## 另请参阅

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

## 版本历史

| 版本 | 变更 |
| - | - |
| **v4** | 引入。 |


## Related topics

- [IGameInputDevice::GetDeviceId](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getdeviceid.md)
- [IGameInputDevice::GetContainerId](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getcontainerid.md)
- [IGameInputDevice（接口内容）](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md)
- [IGameInputDevice::GetVendorId](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getvendorid.md)
- [IGameInputDevice::GetProductId](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getproductid.md)
