HGLOBAL GlobalDiscard(hglb) | ||||
HGLOBAL hglb; | /* handle of object to discard, */ |
The GlobalDiscard macro discards the given global memory object. The lock count of the memory object must be zero.
hglb
Identifies the global memory object to be discarded.
The return value is a handle of the discarded object if the macro is successful. Otherwise, it is NULL.
The GlobalDiscard macro discards only global objects that an application allocated with the GMEM_DISCARDABLE and GMEM_MOVEABLE flags set. The macro fails if an application attempts to discard a fixed or locked object.
Although GlobalDiscard removes the global memory object from memory, the object's handle remains valid. An application can subsequently pass the handle to the GlobalReAlloc function to allocate another global memory object identified by the same handle.
The GlobalDiscard macro is defined in WINDOWS.H as follows:
#define GlobalDiscard(h) GlobalReAlloc(h, 0L, GMEM_MOVEABLE)