Share via


GraphicsCaptureItem.TryCreateFromDisplayId(DisplayId) Method

Definition

Attempts to create a GraphicsCaptureItem that represents the display with the specified DisplayId.

public:
 static GraphicsCaptureItem ^ TryCreateFromDisplayId(DisplayId displayId);
 static GraphicsCaptureItem TryCreateFromDisplayId(DisplayId const& displayId);
public static GraphicsCaptureItem TryCreateFromDisplayId(DisplayId displayId);
function tryCreateFromDisplayId(displayId)
Public Shared Function TryCreateFromDisplayId (displayId As DisplayId) As GraphicsCaptureItem

Parameters

displayId
DisplayId

The DisplayId with which to construct the GraphicsCaptureItem.

Returns

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

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

See also