> ## 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 方法

> IXtfConsoleManager::SetDefaultConsole 方法

# IXtfConsoleManager::SetDefaultConsole 方法

設定 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](/zh-TW/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManager/ixtfconsolemanager-xtfconsolemanager-xbox-microsoft-t) 執行個體中別名為 `pszAlias` 所指定的開發主機，設為在此電腦上與 XBOX Tools Framework (XTF) 工具和 API 搭配使用的預設開發主機。

成功呼叫此方法之後，`IXtfConsoleManager` 執行個體會從相關聯的 [IXtfConsoleManagerCallback](/zh-TW/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManagerCallback/ixtfconsolemanagercallback-xtfconsolemanager-xbox-microsoft-t) 執行個體叫用 [OnChangedDefaultConsole](/zh-TW/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManagerCallback/methods/onchangeddefaultconsole-ixtfconsolemanagercallback-xtfconsolemanager-xbox) 回呼方法。

如需連線及查詢開發主機的詳細資訊，請參閱[連線 (xbconnect.exe) (NDA 主題)](/zh-TW/tools/tools-console/commandlinetools/xbconnect)。

<a id="requirementsSection" />

## 需求

**標頭：** xtfconsolemanager.h

**程式庫：** xtfconsolemanager.lib

**支援的平台：** Windows (適用於 XBOX 主機工具)

<a id="seealsoSection" />

## 另請參閱

[IXtfConsoleManager 介面](/zh-TW/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManager/ixtfconsolemanager-xtfconsolemanager-xbox-microsoft-t)\
[XtfConsoleManager](/zh-TW/reference/tools/xtf/xtfconsolemanager/xtfconsolemanager-xbox-microsoft-n)


## Related topics

- [IXtfConsoleManager::AddConsole 方法](/zh-TW/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManager/methods/addconsole-ixtfconsolemanager-xtfconsolemanager-xbox-microsoft-m.md)
- [XtfGetSavedConsoleAddress](/zh-TW/reference/tools/xtf/xtfapi/functions/xtfgetsavedconsoleaddress-xtfapi-xbox-windows-m.md)
- [XtfGetDefaultAddress](/zh-TW/reference/tools/xtf/xtfconsolemanager/methods/xtfgetdefaultaddress-xtfconsolemanager-xbox-windows-m.md)
- [IXtfConsoleManagerCallback::OnChangedDefaultConsole 方法](/zh-TW/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManagerCallback/methods/onchangeddefaultconsole-ixtfconsolemanagercallback-xtfconsolemanager-xbox.md)
- [IXtfConsoleManager::GetDefaultConsole 方法](/zh-TW/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManager/methods/getdefaultconsole-ixtfconsolemanager-xtfconsolemanager-xbox-microsoft-m.md)
