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

# XAppCaptureRecordDiagnosticClip

> XAppCaptureRecordDiagnosticClip

# XAppCaptureRecordDiagnosticClip

從您的應用程式錄製診斷剪輯。

## 語法

```cpp theme={null}
HRESULT XAppCaptureRecordDiagnosticClip(  
         time_t startTime,  
         uint32_t durationInMs,  
         const char* filenamePrefix,  
         XAppCaptureRecordClipResult* result  
)  
```

### 參數

*startTime*   \_In\_\
類型：time\_t

診斷剪輯開始的時間戳記。

*durationInMs*   \_In\_\
類型：uint32\_t

診斷剪輯的持續時間 (毫秒)。

*filenamePrefix*   \_In\_opt\_\
類型：char\*

所需的檔案名稱前置詞 (選用)，會附加在診斷檔案名稱的前面。

*result*   \_Out\_\
類型：[XAppCaptureRecordClipResult\*](/zh-TW/reference/system/xappcapture/structs/xappcapturerecordclipresult)

所產生的已錄製診斷剪輯。

### 傳回值

類型：HRESULT

函式結果。

## 備註

<Note>在時間敏感執行緒上呼叫此函式並不安全。如需詳細資訊，請參閱[時間敏感執行緒](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)。</Note>

呼叫此函式不會觸發 UI 通知。剪輯會儲存到遊戲可存取的磁碟分割。[XAppCaptureRecordDiagnosticClipResult](/zh-TW/reference/system/xappcapture/structs/xappcapturerecordclipresult) 包含檔案路徑，您可以用來存取剪輯。
在 XBOX 上，此函式只能在開發套件上使用。在零售主機上，此 API 會立即傳回錯誤。

在 PC 上，您必須為應用程式啟用背景錄製，此函式才能運作。最佳做法是按 Win+G 開啟 Game Bar，然後按一下 \[設定] 圖示，前往 \[擷取] 索引標籤，並啟用「在我玩遊戲時於背景錄製」。
接著，您必須將應用程式標示為遊戲。最佳做法是先執行您的遊戲。在遊戲處於焦點時，按 Win+G 開啟 Game Bar，然後按一下 \[設定] 圖示，前往 \[一般] 索引標籤，並勾選「記住這是遊戲」。

## 需求

**標頭：** XAppCapture.h

**程式庫：** xgameruntime.lib

**支援的平台：** Windows、XBOX One 系列主機和 XBOX Series 主機

## 概念文件

* [時間敏感執行緒](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## 另請參閱

[GameDVR 概觀](/zh-TW/build/console-features/game-dvr/gamedvr-broadcast)\
[XAppCapture 成員](/zh-TW/reference/system/xappcapture/xappcapture_members)\
[XAppCaptureRecordDiagnosticClipResult](/zh-TW/reference/system/xappcapture/structs/xappcapturerecordclipresult)


## Related topics

- [XAppCaptureRecordDiagnosticClip](/reference/system/xappcapture/functions/xappcapturerecorddiagnosticclip.md)
- [XAppCaptureRecordClipResult](/reference/system/xappcapture/structs/xappcapturerecordclipresult.md)
