GlobalUnlock

Syntax

BOOL GlobalUnlock(hMem)

This function unlocks the global memory block specified by the hMem parameter.

In real mode, or if the block is discardable, GlobalUnlock decreases the block's lock count by one. In protected mode, GlobalUnock decreases the lock count of discardable objects and automatic data segments only.

The block is completely unlocked and subject to moving or discarding if the lock count is decreased to zero. Other functions also can affect the lock count of a memory object. See the description of the GlobalFlags function for a list of the functions that affect the lock count.

In all cases, each time an application calls GlobalLock for an object, it must eventually call GlobalUnlock for the object.

Parameter Type/Description  

hMem HANDLE Identifies the global memory block to be unlocked.  

Return Value

The return value specifies the outcome of the function. It is zero if the block's lock count was decreased to zero. Otherwise, the return value is nonzero. An application should not rely on the return value to determine the number of times it must subsequently call GlobalUnlock for the memory block.