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

# WdGetDefaultDevice

> WdGetDefaultDevice

返回已保存的默认设备（如果已选择）。

**引入版本：** [RIT 0.0.14-preview](https://docs.xbox.com/zh-CN/reference/remoting/release-versions.md#release-versions)。

## 语法

```cpp theme={null}
HRESULT WD_REMOTE_ITERATION_CALL WdGetDefaultDevice(
    _Out_ bool* deviceFound,
    _In_ WdDeviceInfoResultCallback callback,
    _In_opt_ void* context
);
```

### 参数

`deviceFound`\
类型：**bool\***

必需的输出，指示是否已选择默认设备。

`callback`\
类型：**WdDeviceInfoResultCallback**

必需的结果回调或枚举回调。有关继续和生存期规则，请参阅“备注”。

`context`\
类型：**void\***

可选的调用方拥有的上下文，会原样传递给回调。

### 返回值

类型：**HRESULT**

成功时返回 `S_OK`；否则返回失败 HRESULT。目录操作还会返回[错误代码](https://docs.xbox.com/zh-CN/reference/remoting/error-codes.md)中所述的特定于目录的错误。

## 备注

`deviceFound` 和回调都是必需的。如果没有默认设备，调用会成功，将 `deviceFound` 设置为 `false`，并且不会调用回调。如果存在默认设备，回调会接收其记录。此本地查询不会探测连接或授权。

已保存设备 API 和配对 ID API 会更改不同的本地存储。它们不会取代远程 API 调用中显式的 `remoteDevice` 参数；需要默认选择的调用方必须自行解析默认设备。

## 要求

| 要求 | 值 |
| - | - |
| **头文件** | WdRemoteIteration.h |
| **库** | wdremoteapi.lib |
| **NuGet 包** | [Microsoft.GDK.RemoteIterationClientApi](https://aka.ms/GameDevRemoteAPI) |

## 另请参阅

* [XBOX PC 远程迭代 API](https://docs.xbox.com/zh-CN/reference/remoting/remoteiteration_members.md)


## Related topics

- [XBOX PC Remote Iteration API](https://docs.xbox.com/zh-CN/reference/remoting/remoteiteration_members.md)
- [WdSetDefaultDevice](https://docs.xbox.com/zh-CN/reference/remoting/functions/wdsetdefaultdevice.md)
- [WdGetDevice](https://docs.xbox.com/zh-CN/reference/remoting/functions/wdgetdevice.md)
- [WdGetDeviceProperty](https://docs.xbox.com/zh-CN/reference/remoting/functions/wdgetdeviceproperty.md)
- [WdGetDeviceStoragePath](https://docs.xbox.com/zh-CN/reference/remoting/functions/wdgetdevicestoragepath.md)
