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

> 检索设备定义的原始输出报告的说明。

检索设备定义的原始输出报告的说明。

## 语法

```cpp theme={null}
uint32_t GetOutputReportInfo(
    uint32_t infoArrayCount,
    GameInputRawDeviceReportInfo* infoArray
);
```

### 参数

*infoArrayCount*   \_In\_\
类型：uint32\_t

*infoArray* 中的元素数量。若要检索所有输出报告，请传递 [GetOutputReportCount](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getoutputreportcount.md) 返回的值。

*infoArray*   \_Out\_writes\_to\_opt\_(infoArrayCount, return)\
类型：[GameInputRawDeviceReportInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/structs/gameinputrawdevicereportinfo.md)\*

指向数组的指针，该数组为每个输出报告接收一个结构。可以为 `nullptr`，在这种情况下不会写入任何内容，并且方法返回 0。

### 返回值

类型：uint32\_t

写入 *infoArray* 的元素数量。该值为 *infoArrayCount* 与设备上输出报告数量中的较小者；如果 *infoArray* 为 `nullptr` 或设备没有输出报告，则为 0。

## 备注

每个元素都是一个 [GameInputRawDeviceReportInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/structs/gameinputrawdevicereportinfo.md) 结构，其 `kind` 成员为 `GameInputRawOutputReport`，`id` 成员为设备定义的报告 ID，`size` 成员为报告数据的大小（以字节为单位）。

调用 [GetOutputReportCount](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getoutputreportcount.md) 获取输出报告的数量，分配该大小的数组，然后调用 `GetOutputReportInfo` 填充该数组。如果 *infoArrayCount* 小于输出报告的数量，则只写入前 *infoArrayCount* 个元素。在设备保持连接期间，设备的输出报告不会更改，因此你可以只查询一次并缓存结果。

将元素的 `id` 成员与 `GameInputRawOutputReport` 一起用作 [CreateRawDeviceReport](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_createrawdevicereport.md) 的 *reportId* 参数，以创建可通过 [SendRawDeviceOutput](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_sendrawdeviceoutput.md) 发送的输出报告。`size` 成员给出设备期望的报告数据字节数。

以下示例演示如何检索设备的输出报告。

```cpp theme={null}
uint32_t reportCount = device->GetOutputReportCount();
std::vector<GameInputRawDeviceReportInfo> reports(reportCount);
reports.resize(device->GetOutputReportInfo(reportCount, reports.data()));

for (const GameInputRawDeviceReportInfo& report : reports)
{
    Microsoft::WRL::ComPtr<IGameInputRawDeviceReport> output;
    if (SUCCEEDED(device->CreateRawDeviceReport(report.id, GameInputRawOutputReport, &output)))
    {
        // Fill the report with SetRawData, then send it with SendRawDeviceOutput.
    }
}
```

在 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) 结构的 `outputReportInfo` 成员中获取。

## 要求

**头文件：** 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)\
[GetOutputReportCount](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getoutputreportcount.md)\
[GameInputRawDeviceReportInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/structs/gameinputrawdevicereportinfo.md)\
[GameInputRawDeviceReportKind](https://docs.xbox.com/zh-CN/reference/input/gameinput/enums/gameinputrawdevicereportkind.md)\
[IGameInputRawDeviceReport](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputrawdevicereport/igameinputrawdevicereport.md)\
[CreateRawDeviceReport](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_createrawdevicereport.md)\
[SendRawDeviceOutput](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_sendrawdeviceoutput.md)\
[GameInput 高级主题](https://docs.xbox.com/zh-CN/build/core-features/common/input/advanced/input-advanced-topics.md)\
[IGameInputDevice](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md)

## 版本历史

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


## Related topics

- [GameInputRawDeviceReportInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/structs/gameinputrawdevicereportinfo.md)
- [IGameInputDevice::GetOutputReportCount](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getoutputreportcount.md)
- [IGameInputDevice::GetInputReportInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getinputreportinfo.md)
- [IGameInputDevice::GetFeatureReportInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getfeaturereportinfo.md)
- [IGameInputDevice::GetInputReportCount](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getinputreportcount.md)
