> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GetDeviceInfo

> GetDeviceInfo

# GetDeviceInfo

存取有關輸入裝置完整屬性和功能的靜態資訊。

## 語法

```cpp theme={null}
HRESULT GetDeviceInfo(
    const GameInputDeviceInfo** info
);
```

### 參數

*info*   \_Outptr\_\
類型：GameInputDeviceInfo\*\*

與 IGameInputDevice 相關聯的裝置資訊。

### 傳回值

類型：HRESULT

函式結果。

## 備註

`GetDeviceInfo` 方法的記憶體不屬於應用程式所有。只要應用程式讓 `IGameInput` 執行個體保持運作，該記憶體就會維持可存取。一旦釋放對 `IGameInput` 物件的參考，該記憶體就會消失。

下列程式碼範例示範如何判斷賽車方向盤是否具有離合器。

```cpp theme={null}
bool HasClutch(IGameInputDevice* wheel) noexcept
{
    const GameInputDeviceInfo* wheelInfo = nullptr;
    const bool succeeded = wheel->GetDeviceInfo(&wheelInfo);
    assert(succeeded);
    assert(wheelInfo->racingWheelInfo);

    const bool hasClutch = wheelInfo->racingWheelInfo->hasClutch;

    return hasClutch;
}
```

## 需求

**標頭：** GameInput.h

[GameInput 概觀](/zh-TW/build/core-features/common/input/overviews/input-overview)\
[GameInputDeviceInfo](/zh-TW/reference/input/gameinput/structs/gameinputdeviceinfo)\
[IGameInputDevice](/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice)

## 版本歷程記錄

| 版本 | 變更 |
| - | - |
| **v3** | 簽章未變更。[GameInputDeviceInfo](/zh-TW/reference/input/gameinput/structs/gameinputdeviceinfo) 已擴充：新增 `controllerInfo` (取代個別的軸/按鈕/切換開關計數與資訊欄位以及 `uiNavigationInfo`)；新增 `inputReportCount`/`inputReportInfo` 和 `outputReportCount`/`outputReportInfo`；移除 `hapticFeedbackMotorInfo`。 |
| **v2** | 簽章未變更。[GameInputDeviceInfo](/zh-TW/reference/input/gameinput/structs/gameinputdeviceinfo) 已擴充，新增 `revisionNumber`、`hardwareVersion`、`firmwareVersion`、`containerId` 和 `sensorsInfo`。 |
| **v1** | 簽章未變更。[GameInputDeviceInfo](/zh-TW/reference/input/gameinput/structs/gameinputdeviceinfo) 已大幅簡化：移除 `infoSize`、`interfaceNumber`、`collectionNumber`、`capabilities` 以及觸控/觸覺/字串/描述元欄位；新增 `supportedSystemButtons`、`displayName` 和 `pnpPath`。 |
| **v0** | 已推出。 |


## Related topics

- [GetDeviceInfo](/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getdeviceinfo.md)
- [GameInputDeviceInfo](/reference/input/gameinput/structs/gameinputdeviceinfo.md)
- [GameInputRawDeviceReportInfo](/reference/input/gameinput/structs/gameinputrawdevicereportinfo.md)
- [GameInputSensorsInfo](/reference/input/gameinput/structs/gameinputsensorsinfo.md)
- [GameInputGamepadInfo](/reference/input/gameinput/structs/gameinputgamepadinfo.md)
