Skip to main content

XAppCaptureReadScreenshotStream

Reads a screenshot stream.

Syntax

Parameters

handle   _In_
Type: XAppCaptureScreenshotStreamHandle
Screenshot stream handle returned by calling XAppCaptureOpenScreenshotStream. startPosition   _In_
Type: uint64_t
Position in the stream to start reading. bytesToRead   _In_
Type: uint32_t
Number of bytes in the stream to read. buffer   _Out_writes_to_(bytesToRead,bytesWritten)
Type: uint8_t
Buffer to contain the bytes read by XAppCaptureReadScreenshotStream. bytesWritten   _Out_
Type: uint32_t*
Number of bytes actually written to the buffer.

Return value

Type: HRESULT Function result.

Remarks

This function isn’t safe to call on a time-sensitive thread. For more information, see Time-sensitive threads.
Before reading a screenshot you must open a screenshot stream with XAppCaptureOpenScreenShotStream. This will produce the XAppCaptureScreenshotStreamHandle needed for the handle parameter. You may then call this function to read the screenshot. The startPosition and bytesToRead parameters will allow you to read a section of the screenshot, this is useful for reading a large stream a section at a time. You can get the total size of the stream from the totalBytes output parameter in XAppCaptureOpenScreenShotStream. The output parameters buffer and bytesWritten will help you accurately read the data returned from this function. After reading the screenshot data close the screenshot stream with XAppCaptureCloseScreenshotStream in order to avoid a memory leak.

Requirements

Header: XAppCapture.h Library: xgameruntime.lib Supported platforms: Windows, XBOX One family consoles and XBOX Series consoles

Conceptual documentation

See also

GameDVR Overview
XAppCapture Members
XAppCaptureOpenScreenShotStream
XAppCaptureTakeScreenshot
XAppCaptureCloseScreenshotStream
Last modified on August 20, 2026