DisplayManager Class

Definition

Manages the ownership of a DisplayTarget object or objects, and provides methods to create DisplayState objects.

public ref class DisplayManager sealed : IClosable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 458752)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class DisplayManager final : IClosable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 458752)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class DisplayManager : System.IDisposable
Public NotInheritable Class DisplayManager
Implements IDisposable
Inheritance
Object Platform::Object IInspectable DisplayManager
Attributes
Implements

Windows requirements

Device family
Windows 10, version 1809 (introduced in 10.0.17763.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v7.0)

Remarks

This object implements IClosable/IDisposable, which should be used to revoke ownership of all DisplayTarget objects once they are no longer being used.

Methods

Close()

Revokes ownership of all DisplayTarget objects owned by this DisplayManager instance.

Create(DisplayManagerOptions)

Creates a DisplayManager instance with the specified options.

CreateDisplayDevice(DisplayAdapter)

Creates a DisplayDevice object for the given adapter. The DisplayDevice can be used to create and present full-screen content to targets on the given adapter.

CreateDisplayDeviceForIndirectAdapter(DisplayAdapter, DisplayAdapter)
Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

GetCurrentAdapters()

Enumerates the set of display adapters currently present on the system.

GetCurrentTargets()

Enumerates the set of display targets currently present on the system.

ReleaseTarget(DisplayTarget)

Releases ownership of the specified display target, allowing other components on the system to acquire ownership.

Start()

Starts listening for all DisplayManager events atomically. DisplayManager events are not raised until you call Start.

Stop()

Stops listening to all DisplayManager events atomically, and triggers Disabled synchronously.

TryAcquireTarget(DisplayTarget)

Attempts to acquire exclusive ownership of a DisplayTarget.

TryAcquireTargetsAndCreateEmptyState(IIterable<DisplayTarget>)

Attempts to acquire exclusive ownership of a collection of DisplayTarget objects, and creates an empty modifiable DisplayState object, which supports connecting paths to these targets.

TryAcquireTargetsAndCreateSubstate(DisplayState, IIterable<DisplayTarget>)

Attempts to acquire exclusive ownership of a collection of DisplayTarget objects, and carves out a subset of a given DisplayState for only the targets passed to this method. The resulting state can be modified and applied.

TryAcquireTargetsAndReadCurrentState(IIterable<DisplayTarget>)

Attempts to acquire exclusive ownership of a collection of DisplayTarget objects, and creates a modifiable DisplayState populated with the current state of the supplied targets.

TryReadCurrentStateForAllTargets()

Creates a read-only DisplayState object populated with the entire system display state for all targets.

TryReadCurrentStateForModeQuery()

Events

Changed

An event that is raised when system display hardware is added, removed, or modified. This can occur whenever the DisplayAdapter or DisplayTarget collections change. Use this event to detect these changes and call GetCurrentAdapters and/or GetCurrentTargets to get the updated collections.

Disabled

An event raised whenever the current session's display stack is disabled, and when DisplayManager.Stop is called. You can disable the session display stack in several cases, such as switching Terminal Services sessions, or to recover from driver failures. We recommend that subscribers attempt to clean up when Disabled is invoked. Most display APIs will fail while the session display stack is disabled.

Enabled

An event raised whenever the current session's display stack is enabled, and when DisplayManager.Start is called. You can re-enable the session display stack in several cases, such as switching Terminal Services sessions, or to recover from driver failures. We recommend that subscribers re-enumerate all targets and state in this call, since the system display stack could be left in any state before this event is raised.

PathsFailedOrInvalidated

An event that is raised whenever a display path is failed or invalidated asynchronously by the system. This can be due to changing hardware bandwidth requirements, or due to driver failures.

Subscribers to this event should call TryAcquireTargetsAndReadCurrentState for targets that they own, and check whether any of the paths in the resulting DisplayState object have their Status property set to FailedAsync or InvalidatedAsync, and take the recommended action.

Applies to