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

# IGameInput::FindDeviceFromId

> IGameInput::FindDeviceFromId

# IGameInput::FindDeviceFromId

基于标识符检索设备。

## 语法

```cpp theme={null}
HRESULT FindDeviceFromId(
    const APP_LOCAL_DEVICE_ID* value,
    IGameInputDevice** device
);
```

### 参数

*value*   \_In\_\
类型：APP\_LOCAL\_DEVICE\_ID\*

系统生成的设备 ID。

*device*   \_COM\_Outptr\_\
类型：IGameInputDevice\*\*

返回的设备。

### 返回值

类型：HRESULT

函数结果。

## 备注

获取后，[IGameInputDevice](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md) 实例可用作轮询 API（如 [IGameInput::GetCurrentReading](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinput/methods/igameinput_getcurrentreading.md)）或基于事件的 API（如 [IGameInput::RegisterReadingCallback](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinput/methods/igameinput_registerreadingcallback.md)）中的筛选器（用于检索输入），或直接用于访问特定于设备的信息和功能。如果所提供的标识符无法与任何已知的 GameInput 设备对象匹配，GetDeviceFrom\* 方法将返回 `NULL` 指针。这些方法查询调用进程内的本地状态并快速返回，因此可以从时间敏感的上下文中安全调用。

## 要求

**标头：** GameInput.h

[输入 API 概述](https://docs.xbox.com/zh-CN/build/core-features/common/input/overviews/input-overview.md)\
[IGameInput](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinput/igameinput.md)\
[IGameInputDevice](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md)\
[IGameInput::GetCurrentReading](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinput/methods/igameinput_getcurrentreading.md)\
[IGameInput::RegisterReadingCallback](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinput/methods/igameinput_registerreadingcallback.md)

## 版本历史

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


## Related topics

- [IGameInput::FindDeviceFromObject（已弃用）](https://docs.xbox.com/zh-CN/reference/input/gameinput/deprecated/interfaces/igameinput/methods/igameinput_finddevicefromobject.md)
- [IGameInput::FindDeviceFromPlatformHandle（已弃用）](https://docs.xbox.com/zh-CN/reference/input/gameinput/deprecated/interfaces/igameinput/methods/igameinput_finddevicefromplatformhandle.md)
- [APP_LOCAL_DEVICE_ID](https://docs.xbox.com/zh-CN/reference/system/xuser/structs/app_local_device_id.md)
- [IGameInput::FindDeviceFromPlatformString](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinput/methods/igameinput_finddevicefromplatformstring.md)
- [IGameInput::CreateAggregateDevice](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinput/methods/igameinput_createaggregatedevice.md)
