> ## 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-TW/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md) 執行個體，此執行個體會彙總指定 [GameInputKind](https://docs.xbox.com/zh-TW/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-TW/reference/input/gameinput/enums/gameinputkind.md)

傳回的虛擬 [IGameInputDevice](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md) 將為其彙總讀數的輸入類型。

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

產生的彙總裝置之裝置識別碼。

### 傳回值

類型：HRESULT

函式結果。當使用不支援的 [GameInputKind](https://docs.xbox.com/zh-TW/reference/input/gameinput/enums/gameinputkind.md) 或嘗試合併 [GameInputKind](https://docs.xbox.com/zh-TW/reference/input/gameinput/enums/gameinputkind.md) 旗標時，會傳回失敗。

## 備註

用於 CreateAggregateDevice 的輸入種類必須是 [GameInputKind](https://docs.xbox.com/zh-TW/reference/input/gameinput/enums/gameinputkind.md) 列舉中的單一值。不支援合併 [GameInputKind](https://docs.xbox.com/zh-TW/reference/input/gameinput/enums/gameinputkind.md) 旗標。如果應用程式需要多種輸入種類的彙總輸入，則必須為每一種輸入種類建立虛擬 [IGameInputDevice](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md) 執行個體。

> [!NOTE]
>
> 此函式用於重新啟用可能已透過呼叫 [DisableAggregateDevice](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinput/methods/igameinput_disableaggregatedevice.md) 而停用的彙總裝置。其結果是重新啟用該裝置，而不是建立另一個執行個體。

彙總裝置也會透過呼叫 [RegisterDeviceCallback](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinput/methods/igameinput_registerdevicecallback.md) 所註冊的回呼發出狀態通知。

僅下列輸入種類支援彙總：

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

## 需求

**標頭：** GameInput.h

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

## 版本歷程記錄

| 版本 | 變更 |
| - | - |
| **v3** | 已實作 (先前在 v0 中為 E\_NOTIMPL) 並重新推出。簽章已變更：`IGameInputDevice**` 已由 `APP_LOCAL_DEVICE_ID*` 取代。 |
| **v1** | 已移除。 |
| **v0** | 已推出但未實作。 |


## Related topics

- [IGameInput::DisableAggregateDevice](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinput/methods/igameinput_disableaggregatedevice.md)
- [CreateRawDeviceReport](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_createrawdevicereport.md)
- [IGameInput::CreateDispatcher](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinput/methods/igameinput_createdispatcher.md)
- [IGameInput::FindDeviceFromId](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinput/methods/igameinput_finddevicefromid.md)
- [IGameInput::RegisterDeviceCallback](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinput/methods/igameinput_registerdevicecallback.md)
