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

# XtfGetDefaultAddress

> XtfGetDefaultAddress

# XtfGetDefaultAddress

返回此 PC 的默认开发主机的 IP 地址。

<a id="syntaxSection" />

## 语法

```cpp theme={null}
HRESULT XtfGetDefaultAddress(
         LPBSTR pbstrAddress
)  
```

<a id="parametersSection" />

### 参数

*pbstrAddress*\
类型：LPBSTR

此 PC 用于其默认开发主机的 IP 地址。

<a id="retvalSection" />

### 返回值

类型：HRESULT

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

<a id="remarksSection" />

## 备注

如果成功，此方法会在 `pbstrAddress` 中获取此 PC 默认开发主机的 IP 地址。你还可以使用 [IXtfConsoleManager::GetDefaultConsole](/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManager/methods/getdefaultconsole-ixtfconsolemanager-xtfconsolemanager-xbox-microsoft-m) 方法检索有关默认开发主机的更多信息，或通过调用 [IXtfConsoleManager::SetDefaultConsole](/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManager/methods/setdefaultconsole-ixtfconsolemanager-xtfconsolemanager-xbox-microsoft-m) 方法来设置默认开发主机。默认开发主机由其他 XBOX Tools Framework (XTF) 工具和 API 使用。

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

<a id="remarks_output" />

### 处理 LPBSTR 指针

有关处理此方法返回的 LPBSTR 指针的详细信息，请参阅 [为 BSTR 分配和释放内存](https://learn.microsoft.com/cpp/atl-mfc-shared/allocating-and-releasing-memory-for-a-bstr?view=vs-2019)。

<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

- [XtfCreateConsoleManager](/zh-CN/reference/tools/xtf/xtfconsolemanager/methods/xtfcreateconsolemanager-xtfconsolemanager-xbox-microsoft-m.md)
- [XtfGetSavedConsoleAddress](/zh-CN/reference/tools/xtf/xtfapi/functions/xtfgetsavedconsoleaddress-xtfapi-xbox-windows-m.md)
- [IXtfConsoleManager::GetDefaultConsole Method](/zh-CN/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManager/methods/getdefaultconsole-ixtfconsolemanager-xtfconsolemanager-xbox-microsoft-m.md)
- [XtfGetConsoleFieldValue](/zh-CN/reference/tools/xtf/xtfapi/functions/xtfgetconsolefieldvalue-xbox-microsoft-m.md)
- [IXtfConsoleManager::AddConsole method](/zh-CN/reference/tools/xtf/xtfconsolemanager/classes/IXtfConsoleManager/methods/addconsole-ixtfconsolemanager-xtfconsolemanager-xbox-microsoft-m.md)
