> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# IXtfConsoleManager::SetDefaultConsole Method

> IXtfConsoleManager::SetDefaultConsole Method

# IXtfConsoleManager::SetDefaultConsole Method

设置 XBOX Tools Framework (XTF) 工具和 API 的默认开发主机。

<a id="syntaxSection" />

## 语法

```cpp theme={null}
public:
HRESULT SetDefaultConsole(
         LPCWSTR pszAlias
)  
```

<a id="parametersSection" />

### 参数

*pszAlias*\
类型：LPCWSTR

指向要设为默认开发主机的开发主机名称的指针。

<a id="retvalSection" />

### 返回值

类型：HRESULT

如果成功，则返回 `S_OK`；否则返回 HRESULT 错误代码。

<a id="remarksSection" />

## 备注

此方法将 [IXtfConsoleManager](/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManager/ixtfconsolemanager-xtfconsolemanager-xbox-microsoft-t) 实例中别名由 `pszAlias` 指定的开发主机设置为要在此 PC 上与 XBOX Tools Framework (XTF) 工具和 API 一起使用的默认开发主机。

成功调用此方法后，`IXtfConsoleManager` 实例会从关联的 [IXtfConsoleManagerCallback](/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManagerCallback/ixtfconsolemanagercallback-xtfconsolemanager-xbox-microsoft-t) 实例调用 [OnChangedDefaultConsole](/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManagerCallback/methods/onchangeddefaultconsole-ixtfconsolemanagercallback-xtfconsolemanager-xbox) 回调方法。

有关连接和查询开发主机的详细信息，请参阅 [Connect (xbconnect.exe) (NDA 主题)](/tools/tools-console/commandlinetools/xbconnect)。

<a id="requirementsSection" />

## 要求

**头文件：** xtfconsolemanager.h

**库：** xtfconsolemanager.lib

**支持的平台：** Windows（适用于 XBOX 主机工具）

<a id="seealsoSection" />

## 另请参阅

[IXtfConsoleManager Interface](/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManager/ixtfconsolemanager-xtfconsolemanager-xbox-microsoft-t)\
[XtfConsoleManager](/reference/tools/xtf/xtfconsolemanager/xtfconsolemanager-xbox-microsoft-n)


## Related topics

- [IXtfConsoleManagerCallback::OnChangedDefaultConsole Method](/zh-CN/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManagerCallback/methods/onchangeddefaultconsole-ixtfconsolemanagercallback-xtfconsolemanager-xbox.md)
- [IXtfConsoleManager::AddConsole method](/zh-CN/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManager/methods/addconsole-ixtfconsolemanager-xtfconsolemanager-xbox-microsoft-m.md)
- [IXtfConsoleManager::GetDefaultConsole Method](/zh-CN/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManager/methods/getdefaultconsole-ixtfconsolemanager-xtfconsolemanager-xbox-microsoft-m.md)
- [IXtfConsoleManager::EnumerateConsoles method](/zh-CN/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManager/methods/enumerateconsoles-ixtfconsolemanager-xtfconsolemanager-xbox-microsoft-m.md)
- [IXtfConsoleManager::RemoveConsole Method](/zh-CN/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManager/methods/removeconsole-ixtfconsolemanager-xtfconsolemanager-xbox-microsoft-m.md)
