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

# GetDeviceInfo (已淘汰)

> 存取輸入裝置完整屬性和功能的靜態資訊 (已在 v4 中移除)。

> [!WARNING]
>
> **已淘汰。** 此方法已在 GameInput v4 中移除，目前的 API 中無法使用。請改用 [IGameInputDevice](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md) 上的個別 getter 方法，例如 [GetVendorId](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getvendorid.md) 和 [GetRacingWheelInfo](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getracingwheelinfo.md)。如需每個 [GameInputDeviceInfo](https://docs.xbox.com/zh-TW/reference/input/gameinput/deprecated/structs/gameinputdeviceinfo.md) 成員與其替代項目的對應，請參閱該頁面的「備註」一節。

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

## 語法

```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 = SUCCEEDED(wheel->GetDeviceInfo(&wheelInfo));
    assert(succeeded);
    assert(wheelInfo->racingWheelInfo);

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

    return hasClutch;
}
```

## 需求

**標頭：** GameInput.h

## 另請參閱

[已淘汰的 GameInput API 成員](https://docs.xbox.com/zh-TW/reference/input/gameinput/deprecated/gameinput_deprecated_members.md)\
[GameInput 概觀](https://docs.xbox.com/zh-TW/build/core-features/common/input/overviews/input-overview.md)\
[GameInputDeviceInfo](https://docs.xbox.com/zh-TW/reference/input/gameinput/deprecated/structs/gameinputdeviceinfo.md)\
[IGameInputDevice](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md)

## 版本歷程記錄

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


## Related topics

- [GameInputDeviceInfo (已淘汰)](https://docs.xbox.com/zh-TW/reference/input/gameinput/deprecated/structs/gameinputdeviceinfo.md)
- [GetDeviceInfo](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getdeviceinfo.md)
- [GetDeviceStatus (已淘汰)](https://docs.xbox.com/zh-TW/reference/input/gameinput/deprecated/interfaces/igameinputdevice/methods/igameinputdevice_getdevicestatus.md)
- [IGameInputDevice::GetRawDeviceFeature (已淘汰)](https://docs.xbox.com/zh-TW/reference/input/gameinput/deprecated/interfaces/igameinputdevice/methods/igameinputdevice_getrawdevicefeature.md)
- [IGameInputDevice::GetBatteryState (已淘汰)](https://docs.xbox.com/zh-TW/reference/input/gameinput/deprecated/interfaces/igameinputdevice/methods/igameinputdevice_getbatterystate.md)
