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

# XtfCaptureOutputBegin

> XtfCaptureOutputBegin

# XtfCaptureOutputBegin

开始捕获调试输出。

<a id="syntaxSection" />

## 语法

```cpp theme={null}
void XtfCaptureOutputBegin(
         PCWSTR address,
         XtfDebugStringCallback debugStringCallback,
         XtfDebugStringErrorCallback debugStringErrorCallback,
         PVOID context,
         PHANDLE hListen
)  
```

<a id="parametersSection" />

### 参数

*address*\
类型：PCWSTR

\[in] 主机的 IP 地址。

*debugStringCallback*\
类型：[XtfDebugStringCallback](/reference/tools/xtf/xtfapi/functions/xtfdebugstringcallback-xtfapi-xbox-windows-m)

\[in, optional] 针对每个输出调试字符串调用的可选回调。

*debugStringErrorCallback*\
类型：[XtfDebugStringErrorCallback](/reference/tools/xtf/xtfapi/functions/xtfdebugstringerrorcallback-xtfapi-xbox-windows-m)

\[in, optional] 针对遇到的每个错误调用的可选回调。

*context*\
类型：PVOID

\[in, optional] 一个指向对象的指针，该对象会被传入回调函数。此对象允许每次回调调用与此次捕获会话相关联。

*hListen*\
类型：PHANDLE

\[out] 表示此次捕获会话的句柄。

<a id="retvalSection" />

### 返回值

无。

<a id="remarksSection" />

## 备注

使用此函数和 [XtfCaptureOutputEnd](/reference/tools/xtf/xtfapi/functions/xtfcaptureoutputend-xtfapi-xbox-windows-m) 函数来开始和停止捕获来自开发主机的一般调试输出。如果你想监视开发主机上特定进程 ID 的调试输出，请使用调试监视客户端。有关使用调试监视客户端的更多信息，请参阅 [XtfCreateDebugMonitorClient](/reference/tools/xtf/xtfdebugmonitor/methods/xtfcreatedebugmonitorclient-xtfdebugmonitor-xbox-microsoft-m)。

如果希望在捕获会话中捕获调试字符串，则必须实现并在 `debugStringCallback` 中指定一个 `XtfDebugStringCallback` 函数。同样，若要捕获捕获会话期间遇到的错误，必须实现并在 `debugStringErrorCallback` 中指定一个 `XtfDebugStringErrorCallback` 函数。但这两个回调函数都不是必需的。

若要停止捕获调试输出并释放与捕获会话关联的资源，请调用 [XtfCaptureOutputEnd](/reference/tools/xtf/xtfapi/functions/xtfcaptureoutputend-xtfapi-xbox-windows-m) 并指定为该捕获会话在 `hListen` 中返回的句柄。

<Note>你必须调用 `XtfCaptureOutputEnd` 来停止捕获会话。否则，该捕获会话会成为孤立会话，与之关联的资源不会被释放，从而导致内存泄漏。</Note>

<a id="requirements" />

## 要求

**头文件：** xtfapi.h

**库：** XtfApi.lib

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

<a id="seealsoSection" />

## 另请参阅

[IXtfDebugMonitorClient 接口](/reference/tools/xtf/xtfdebugmonitor/classes/IXtfDebugMonitorClient/ixtfdebugmonitorclient-xtfdebugmonitor-xbox-microsoft-t)\
[XTF 传输错误 (NDA 主题)](/tools/tools-console/commandlinetools/xtf-transport-errors)\
[其他 Xtf API](/reference/tools/xtf/xtfapi/atoc-xtfapi)


## Related topics

- [XtfCaptureOutputEnd](/zh-CN/reference/tools/xtf/xtfapi/functions/xtfcaptureoutputend-xtfapi-xbox-windows-m.md)
- [XtfDebugStringErrorCallback](/zh-CN/reference/tools/xtf/xtfapi/functions/xtfdebugstringerrorcallback-xtfapi-xbox-windows-m.md)
- [XtfDebugStringCallback](/zh-CN/reference/tools/xtf/xtfapi/functions/xtfdebugstringcallback-xtfapi-xbox-windows-m.md)
- [PIXCaptureParameters](/zh-CN/reference/tools/pix3/structs/pixcaptureparameters.md)
- [PIXEndCapture](/zh-CN/reference/tools/pix3/functions/pixendcapture.md)
