Share via


GraphicsCaptureItem.TryCreateFromWindowId(WindowId) Method

Definition

Attempts to create a GraphicsCaptureItem that represents the window with the specified WindowId.

public:
 static GraphicsCaptureItem ^ TryCreateFromWindowId(WindowId windowId);
 static GraphicsCaptureItem TryCreateFromWindowId(WindowId const& windowId);
public static GraphicsCaptureItem TryCreateFromWindowId(WindowId windowId);
function tryCreateFromWindowId(windowId)
Public Shared Function TryCreateFromWindowId (windowId As WindowId) As GraphicsCaptureItem

Parameters

windowId
WindowId

The WindowId with which to construct the GraphicsCaptureItem.

Returns

Upon success, returns a GraphicsCaptureItem that represents the given window.

Windows requirements

Device family
Windows 10, version 2104 (introduced in 10.0.20348.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v12.0)

Remarks

Before attempting to create a GraphicsCaptureItem with this method, you must call GraphicsCaptureAccess.RequestAccessAsync, passing in a value of GraphicsCaptureAccessKind.Programmatic. To call RequestAccessAsync with GraphicsCaptureAccessKind.Programmatic, you must declare the graphicsCaptureProgrammatic capability in your app's package manifest. For more information, see App capability declarations.

Applies to