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

# IGameInput::CreateAggregateDevice

> IGameInput::CreateAggregateDevice

# IGameInput::CreateAggregateDevice

创建一个虚拟的 [IGameInputDevice](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md) 实例，该实例聚合指定 [GameInputKind](https://docs.xbox.com/zh-CN/reference/input/gameinput/enums/gameinputkind.md) 的所有输入。

## 语法

```cpp theme={null}
HRESULT CreateAggregateDevice(
         GameInputKind inputKind,
         APP_LOCAL_DEVICE_ID* deviceId
)
```

### 参数

*inputKind*   \_In\_\
类型：[GameInputKind](https://docs.xbox.com/zh-CN/reference/input/gameinput/enums/gameinputkind.md)

返回的虚拟 [IGameInputDevice](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md) 将为其聚合读数的输入类型。

*deviceId*   \_Out\_\
类型：APP\_LOCAL\_DEVICE\_ID\*

聚合设备生成的设备标识符。

### 返回值

类型：HRESULT

函数结果。使用不受支持的 [GameInputKind](https://docs.xbox.com/zh-CN/reference/input/gameinput/enums/gameinputkind.md) 或尝试组合 [GameInputKind](https://docs.xbox.com/zh-CN/reference/input/gameinput/enums/gameinputkind.md) 标志时返回失败。

## 备注

用于 CreateAggregateDevice 的输入类型必须是 [GameInputKind](https://docs.xbox.com/zh-CN/reference/input/gameinput/enums/gameinputkind.md) 枚举中的单一值。不支持组合 [GameInputKind](https://docs.xbox.com/zh-CN/reference/input/gameinput/enums/gameinputkind.md) 标志。如果应用程序需要针对多种输入类型的聚合输入，则必须为每种类型创建一个虚拟 [IGameInputDevice](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md) 实例。

> [!NOTE]
>
> 此函数用于重新启用已通过调用 [DisableAggregateDevice](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinput/methods/igameinput_disableaggregatedevice.md) 而被禁用的聚合设备。它的结果是重新启用该设备，而不是创建另一个实例。

聚合设备还将通过调用 [RegisterDeviceCallback](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinput/methods/igameinput_registerdevicecallback.md) 注册的回调发出状态通知。

仅支持以下输入类型的聚合：

* GameInputKindKeyboard
* GameInputKindMouse
* GameInputKindArcadeStick
* GameInputKindFlightStick
* GameInputKindGamepad
* GameInputKindRacingWheel

## 要求

**标头：** GameInput.h

[输入 API 概述](https://docs.xbox.com/zh-CN/build/core-features/common/input/overviews/input-overview.md)\
[IGameInput](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinput/igameinput.md)

## 版本历史

| 版本 | 变更 |
| - | - |
| **v3** | 已实现（此前在 v0 中为 E\_NOTIMPL）并重新引入。签名变更：`IGameInputDevice**` 替换为 `APP_LOCAL_DEVICE_ID*`。 |
| **v1** | 已移除。 |
| **v0** | 引入但未实现。 |


## Related topics

- [IGameInput::CreateDispatcher](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinput/methods/igameinput_createdispatcher.md)
- [IGameInput::FindDeviceFromId](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinput/methods/igameinput_finddevicefromid.md)
- [IGameInput::RegisterDeviceCallback](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinput/methods/igameinput_registerdevicecallback.md)
- [IGameInput::FindDeviceFromPlatformString](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinput/methods/igameinput_finddevicefromplatformstring.md)
- [IGameInput::FindDeviceFromObject（已弃用）](https://docs.xbox.com/zh-CN/reference/input/gameinput/deprecated/interfaces/igameinput/methods/igameinput_finddevicefromobject.md)
