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

> 擷取裝置所定義之原始功能報告的描述。

擷取裝置所定義之原始功能報告的描述。

## 語法

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

### 參數

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

*infoArray* 中的元素數目。若要擷取所有功能報告，請傳遞 [GetFeatureReportCount](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getfeaturereportcount.md) 傳回的值。

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

指向陣列的指標，此陣列會針對每個功能報告接收一個結構。可以是 `nullptr`，在此情況下不會寫入任何內容，且方法會傳回 0。

### 傳回值

類型：uint32\_t

寫入 *infoArray* 的元素數目。此值為 *infoArrayCount* 與裝置上功能報告數目兩者中的較小值；如果 *infoArray* 為 `nullptr` 或裝置沒有功能報告，則為 0。

## 備註

每個元素都是一個 [GameInputRawDeviceReportInfo](https://docs.xbox.com/zh-TW/reference/input/gameinput/structs/gameinputrawdevicereportinfo.md) 結構，其 `kind` 成員為 `GameInputRawFeatureReport`，`id` 成員為裝置定義的報告識別碼，`size` 成員則為報告資料的大小 (以位元組為單位)。

呼叫 [GetFeatureReportCount](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getfeaturereportcount.md) 以取得功能報告數目，配置該大小的陣列，然後呼叫 `GetFeatureReportInfo` 加以填入。如果 *infoArrayCount* 小於功能報告數目，則只會寫入前 *infoArrayCount* 個元素。在裝置連線期間，裝置的功能報告不會變更，因此您可以只查詢一次並快取結果。

將元素的 `id` 成員當作 [GetRawDeviceFeature](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getrawdevicefeature.md) 的 *reportId* 參數以讀取報告，或將其與 `GameInputRawFeatureReport` 一起當作 [CreateRawDeviceReport](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_createrawdevicereport.md) 的 *reportId* 參數，以建立可透過 [SetRawDeviceFeature](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_setrawdevicefeature.md) 傳送的報告。`size` 成員提供報告資料的位元組數目。

下列範例示範如何擷取裝置的功能報告。

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

for (const GameInputRawDeviceReportInfo& report : reports)
{
    Microsoft::WRL::ComPtr<IGameInputRawDeviceReport> feature;
    if (SUCCEEDED(device->GetRawDeviceFeature(report.id, &feature)))
    {
        // Read the report data with GetRawDataSize and GetRawData.
    }
}
```

## 需求

**標頭：** 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)\
[GetFeatureReportCount](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getfeaturereportcount.md)\
[GameInputRawDeviceReportInfo](https://docs.xbox.com/zh-TW/reference/input/gameinput/structs/gameinputrawdevicereportinfo.md)\
[GameInputRawDeviceReportKind](https://docs.xbox.com/zh-TW/reference/input/gameinput/enums/gameinputrawdevicereportkind.md)\
[IGameInputRawDeviceReport](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputrawdevicereport/igameinputrawdevicereport.md)\
[GetRawDeviceFeature](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getrawdevicefeature.md)\
[SetRawDeviceFeature](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_setrawdevicefeature.md)\
[CreateRawDeviceReport](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_createrawdevicereport.md)\
[GameInput 進階主題](https://docs.xbox.com/zh-TW/build/core-features/common/input/advanced/input-advanced-topics.md)\
[IGameInputDevice](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md)

## 版本歷程記錄

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


## Related topics

- [GameInputRawDeviceReportInfo](https://docs.xbox.com/zh-TW/reference/input/gameinput/structs/gameinputrawdevicereportinfo.md)
- [IGameInputDevice::GetFeatureReportCount](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getfeaturereportcount.md)
- [IGameInputDevice::GetRawDeviceFeature](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getrawdevicefeature.md)
- [IGameInputDevice::SetRawDeviceFeature](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_setrawdevicefeature.md)
- [IGameInputDevice::GetInputReportInfo](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getinputreportinfo.md)
