C# Class AdvancedLauncher.Tools.Win32.User32.HWND

A SafeHandle representing an HWND.
HWNDs have very loose ownership semantics. Unlike normal handles, there is no "CloseHandle" API for HWNDs. There are APIs like CloseWindow or DestroyWindow, but these actually affect the window, not just your handle to the window. This SafeHandle type does not actually do anything to release the handle in the finalizer, it simply provides type safety to the PInvoke signatures. The StrongHWND SafeHandle will actually destroy the HWND when it is disposed or finalized. Because of this loose ownership semantic, the same HWND value can be returned from multiple APIs and can be directly compared. Since SafeHandles are actually reference types, we have to override all of the comparison methods and operators. We also support equality between null and HWND(IntPtr.Zero).
Inheritance: System.Runtime.InteropServices.SafeHandle
Show file Open project: GoldRenard/DMOAdvancedLauncher Class Usage Examples

Public Methods

Method Description
Equals ( HWND other ) : bool
Equals ( object obj ) : bool
GetHashCode ( ) : int
HWND ( IntPtr hwnd ) : System

Public constructor to create an HWND SafeHandle instance for an existing handle.

operator ( ) : bool

Protected Methods

Method Description
HWND ( IntPtr hwnd, bool ownsHandle ) : System

Constructor for derived classes to specify a handle and to control whether or not the handle is owned.

HWND ( bool ownsHandle ) : System

Constructor for derived classes to control whether or not the handle is owned.

ReleaseHandle ( ) : bool

Private Methods

Method Description
HWND ( ) : System
IsWindow ( IntPtr hwnd ) : bool

Method Details

Equals() public method

public Equals ( HWND other ) : bool
other HWND
return bool

Equals() public method

public Equals ( object obj ) : bool
obj object
return bool

GetHashCode() public method

public GetHashCode ( ) : int
return int

HWND() public method

Public constructor to create an HWND SafeHandle instance for an existing handle.
public HWND ( IntPtr hwnd ) : System
hwnd System.IntPtr
return System

HWND() protected method

Constructor for derived classes to specify a handle and to control whether or not the handle is owned.
protected HWND ( IntPtr hwnd, bool ownsHandle ) : System
hwnd System.IntPtr
ownsHandle bool
return System

HWND() protected method

Constructor for derived classes to control whether or not the handle is owned.
protected HWND ( bool ownsHandle ) : System
ownsHandle bool
return System

ReleaseHandle() protected method

protected ReleaseHandle ( ) : bool
return bool

operator() public static method

public static operator ( ) : bool
return bool