HGlobalSafeHandle

Ecng.Interop

Represents a safe handle for unmanaged memory allocated with HGlobal.

继承自: SafeHandleZeroOrMinusOneIsInvalid

构造函数

HGlobalSafeHandle
public HGlobalSafeHandle(IntPtr ptr)
hGlobalSafeHandle = HGlobalSafeHandle(ptr)

Initializes a new instance of the HGlobalSafeHandle class with the specified pointer.

ptr
An IntPtr that represents the allocated unmanaged memory.

方法

ReleaseHandle
protected override bool ReleaseHandle()
result = hGlobalSafeHandle.ReleaseHandle()

Releases the unmanaged memory by freeing the HGlobal allocation.

返回值: true if the handle is released successfully; otherwise, false.