Share via


DisplayTarget.TryGetMonitor Method

Definition

Tries to retrieve an object describing the monitor currently connected to this DisplayTarget. This method can fail or return a different monitor than the properties on the DisplayTarget describe if monitors have been plugged or unplugged from the DisplayTarget since the DisplayTarget object was created. IsStale returns true if the monitor might have changed since the DisplayTarget was created.

public:
 virtual DisplayMonitor ^ TryGetMonitor() = TryGetMonitor;
DisplayMonitor TryGetMonitor();
public DisplayMonitor TryGetMonitor();
function tryGetMonitor()
Public Function TryGetMonitor () As DisplayMonitor

Returns

A DisplayMonitor representing the monitor connected to this target, if one is connected, or else null if nothing is connected.

Remarks

Since this method has Try in its name, it returns null instead of throwing an exception or returning a failure HRESULT.

Applies to