Platform SDK: Memory

GlobalFlags

The GlobalFlags function returns information about the specified global memory object.

Note  This function is provided only for compatibility with 16-bit versions of Windows.

UINT GlobalFlags(
  HGLOBAL hMem   // handle to global memory object
);

Parameters

hMem
[in] Handle to the global memory object. This handle is returned by either the GlobalAlloc or GlobalReAlloc function.

Return Values

If the function succeeds, the return value specifies the allocation values and the lock count for the memory object.

If the function fails, the return value is GMEM_INVALID_HANDLE, indicating that the global handle is not valid. To get extended error information, call GetLastError.

Remarks

The low-order byte of the low-order word of the return value contains the lock count of the object. To retrieve the lock count from the return value, use the GMEM_LOCKCOUNT mask with the bitwise AND (&) operator. The lock count of memory objects allocated with GMEM_FIXED is always zero.

The high-order byte of the low-order word of the return value indicates the allocation values of the memory object. It can be zero or any combination of the following values.

Value Meaning
GMEM_DDESHARE Ignored. This value is provided only for compatibility with 16-bit Windows.
GMEM_DISCARDABLE Ignored. This value is provided only for compatibility with 16-bit Windows.

In Win32, you must explicitly call the GlobalDiscard function to discard a block.

GMEM_DISCARDED The object's memory block has been discarded.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winbase.h; include Windows.h.
  Library: Use Kernel32.lib.

See Also

Memory Management Overview, Memory Management Functions, GlobalAlloc, GlobalDiscard, GlobalReAlloc