HwndSource.Dispose HwndSource.Dispose HwndSource.Dispose HwndSource.Dispose Method

Definition

Releases all managed resources that are used by the HwndSource, and raises the Disposed event.

public:
 virtual void Dispose();
public void Dispose ();
abstract member Dispose : unit -> unit
override this.Dispose : unit -> unit
Public Sub Dispose ()

Implements

Remarks

Important

This method is not available in the Internet security zone.

Dispose initiates related cleanup work for the HWND. If Dispose is called through a thread that is different from the main UI thread, the cleanup work may be deferred until it can be posted to the main UI thread.

Calling Dispose explicitly from the interoperating code might be necessary for certain interoperation scenarios, because an HwndSource in some interoperation scenarios can generate several references to it across the interoperation boundaries that might prevent timely garbage collection.

Applies to

See also