GlobalHandle

The GlobalHandle function retrieves the handle associated with the specified pointer to a global memory block.

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

HGLOBAL GlobalHandle(
  LPCVOID pMem   // pointer to the global memory block
);
 

Parameters

pMem
Pointer to the first byte of the global memory block. This pointer is returned by the GlobalLock function.

Return Values

If the function succeeds, the return value is a handle to the specified global memory object.

If the function fails, the return value is NULL. To get extended error information, call GetLastError.

Remarks

When the GlobalAlloc function allocates a memory object with the GMEM_MOVEABLE flag, it returns a handle to the object. The GlobalLock function converts this handle into a pointer to the memory block, and GlobalHandle converts the pointer back into a handle.

QuickInfo

  Windows NT: Requires version 3.1 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Unsupported.
  Header: Declared in winbase.h.
  Import Library: Use kernel32.lib.

See Also

Memory Management Overview, Memory Management Functions, GlobalAlloc, GlobalLock