> ## 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-CN/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md) 上的各个 getter 方法，例如 [GetVendorId](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getvendorid.md) 和 [GetRacingWheelInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getracingwheelinfo.md)。有关 [GameInputDeviceInfo](https://docs.xbox.com/zh-CN/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-CN/reference/input/gameinput/deprecated/gameinput_deprecated_members.md)\
[GameInput 概述](https://docs.xbox.com/zh-CN/build/core-features/common/input/overviews/input-overview.md)\
[GameInputDeviceInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/deprecated/structs/gameinputdeviceinfo.md)\
[IGameInputDevice](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md)

## 版本历史

| 版本 | 变更 |
| - | - |
| **v4** | 已移除。 |
| **v3** | 签名未变。[GameInputDeviceInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/deprecated/structs/gameinputdeviceinfo.md) 扩展：新增 `controllerInfo`（替换独立的轴/按钮/开关计数+信息字段以及 `uiNavigationInfo`）；新增 `inputReportCount`/`inputReportInfo` 与 `outputReportCount`/`outputReportInfo`；移除 `hapticFeedbackMotorInfo`。 |
| **v2** | 签名未变。[GameInputDeviceInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/deprecated/structs/gameinputdeviceinfo.md) 扩展了 `revisionNumber`、`hardwareVersion`、`firmwareVersion`、`containerId` 和 `sensorsInfo`。 |
| **v1** | 签名未变。[GameInputDeviceInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/deprecated/structs/gameinputdeviceinfo.md) 被大幅简化：移除 `infoSize`、`interfaceNumber`、`collectionNumber`、`capabilities` 以及触摸/触觉/字符串/描述符相关字段；新增 `supportedSystemButtons`、`displayName` 和 `pnpPath`。 |
| **v0** | 引入。 |


## Related topics

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