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

# XAppCaptureTakeDiagnosticScreenshot

> XAppCaptureTakeDiagnosticScreenshot

# XAppCaptureTakeDiagnosticScreenshot

Takes a diagnostic screenshot from your app.

## Syntax

```cpp theme={null}
HRESULT XAppCaptureTakeDiagnosticScreenshot(  
         bool gamescreenOnly,  
         XAppCaptureScreenshotFormatFlag captureFlags,  
         const char* filenamePrefix,  
         XAppCaptureDiagnosticScreenshotResult* result  
)  
```

### Parameters

*gamescreenOnly*   \_In\_\
Type: bool

Determines whether or not only the gamescreen will be captured. If set to false it is possible that some UI like an onscreen keyboard could be captured in addition to the game screen.

*captureFlags*   \_In\_\
Type: [XAppCaptureScreenshotFormatFlag](/reference/system/xappcapture/enums/xappcapturescreenshotformatflag)

Determines whether the capture will be an SDR or HDR capture.

*filenamePrefix*   \_In\_opt\_\
Type: char\*

Desired prefix for the file name, is optional, will be appended to the front of the diagnostic file name.

*result*   \_Out\_\
Type: [XAppCaptureDiagnosticScreenshotResult\*](/reference/system/xappcapture/structs/xappcapturediagnosticscreenshotresult)

The resulting captured screenshot.

### Return value

Type: HRESULT

Function result.

## Remarks

<Note>This function isn't safe to call on a time-sensitive thread. For more information, see [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads).</Note>

Unlike [XAppCaptureTakeScreenshot](/reference/system/xappcapture/functions/xappcapturetakescreenshot), calling this function does not trigger a UI notification. **XAppCaptureTakeDiagnosticScreenshot** uses [XAppCaptureScreenshotFormatFlag](/reference/system/xappcapture/enums/xappcapturescreenshotformatflag) to designate whether the screen capture will be in SDR, HDR, or both. However, you still must be running in HDR to take an HDR capture. Screenshots are saved to a game accessible partition. The [XAppCaptureDiagnosticScreenshotResult](/reference/system/xappcapture/structs/xappcapturediagnosticscreenshotresult) contains an array of [XAppCaptureScreenshotFile](/reference/system/xappcapture/structs/xappcapturescreenshotfile), each struct contains a file path to the screenshot.

This function will only be available on development kits. On retail kits this api will return an error immediately.

## Requirements

**Header:** XAppCapture.h

**Library:** xgameruntime.lib

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

## Conceptual documentation

* [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## See also

[GameDVR Overview](/build/console-features/game-dvr/gamedvr-broadcast)\
[XAppCapture Members](/reference/system/xappcapture/xappcapture_members)\
[XAppCaptureDiagnosticScreenshotResult](/reference/system/xappcapture/structs/xappcapturediagnosticscreenshotresult)\
[XAppCaptureScreenshotFormatFlag](/reference/system/xappcapture/enums/xappcapturescreenshotformatflag)\
[XAppCaptureDiagnosticScreenshotResult](/reference/system/xappcapture/structs/xappcapturediagnosticscreenshotresult)\
[XAppCaptureScreenshotFile](/reference/system/xappcapture/structs/xappcapturescreenshotfile)


## Related topics

- [XAppCaptureDiagnosticScreenshotResult](/reference/system/xappcapture/structs/xappcapturediagnosticscreenshotresult.md)
- [XAppCaptureScreenshotFile](/reference/system/xappcapture/structs/xappcapturescreenshotfile.md)
- [XAppCaptureScreenshotFormatFlag](/reference/system/xappcapture/enums/xappcapturescreenshotformatflag.md)
- [XAppCapture](/reference/system/xappcapture/xappcapture_members.md)
- [Unity C# API wrappers for the GDK](/build/gdk-and-engines/unity/unity-api-wrappers.md)
