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

# WdSetDefaultDevice

> WdSetDefaultDevice

保存済みの既定のデバイスを設定またはクリアします。

**導入バージョン:** [RIT 0.0.14-preview](https://docs.xbox.com/ja-jp/reference/remoting/release-versions.md#release-versions)。

## 構文

```cpp theme={null}
HRESULT WD_REMOTE_ITERATION_CALL WdSetDefaultDevice(
    _In_opt_z_ const char* remoteDevice,
    _In_ bool createIfMissing
);
```

### パラメーター

`remoteDevice`\
Type: **const char\***

選択する保存済みデバイスの名前 (UTF-8)。`createIfMissing` が false の場合に `nullptr` を指定すると、既定がクリアされます。

`createIfMissing`\
Type: **bool**

保存されていないデバイスを選択するときに、最小限のレコードを作成するかどうか。

### 戻り値

Type: **HRESULT**

成功した場合は `S_OK` を返します。それ以外の場合は、エラーを示す HRESULT を返します。カタログ操作では、「[XBOX PC Remote Iteration API エラー コード](https://docs.xbox.com/ja-jp/reference/remoting/error-codes.md)」で説明されているカタログ固有のエラーも返されます。

## 解説

必要に応じて最小限のレコードを作成するには、`createIfMissing` を `true` に設定します。それ以外の場合、レコードが存在しないと `WD_E_DEVICE_NOTFOUND` が返されます。レコードを削除せずに既定をクリアするには、`nullptr` と `false` を渡します。競合する既定の変更を、プロセス間のトランザクションであるかのように発行しないでください。

保存済みデバイスの API とペアリング ID の API は、それぞれ異なるローカル ストアを変更します。これらの API は、リモート API 呼び出しの明示的な `remoteDevice` 引数に代わるものではありません。既定のデバイスを選択したい呼び出し元は、自分で解決する必要があります。

## 要件

| 要件 | 値 |
| - | - |
| **ヘッダー** | WdRemoteIteration.h |
| **ライブラリ** | wdremoteapi.lib |
| **NuGet パッケージ** | [Microsoft.GDK.RemoteIterationClientApi](https://aka.ms/GameDevRemoteAPI) |

## 関連項目

* [XBOX PC Remote Iteration API](https://docs.xbox.com/ja-jp/reference/remoting/remoteiteration_members.md)


## Related topics

- [XBOX PC Remote Iteration API](https://docs.xbox.com/ja-jp/reference/remoting/remoteiteration_members.md)
- [WdSetDevice](https://docs.xbox.com/ja-jp/reference/remoting/functions/wdsetdevice.md)
- [WdGetDefaultDevice](https://docs.xbox.com/ja-jp/reference/remoting/functions/wdgetdefaultdevice.md)
- [WdSetDeviceProperty](https://docs.xbox.com/ja-jp/reference/remoting/functions/wdsetdeviceproperty.md)
- [IGameInputDevice::SetLightingColor](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_setlightingcolor.md)
