GetHGlobalFromStream function (combaseapi.h)

The GetHGlobalFromStream function retrieves the global memory handle to a stream that was created through a call to the CreateStreamOnHGlobal function.


HRESULT GetHGlobalFromStream(
  [in]  LPSTREAM pstm,
  [out] HGLOBAL  *phglobal


[in] pstm

IStream pointer to the stream object previously created by a call to the CreateStreamOnHGlobal function.

[out] phglobal

Pointer to the current memory handle used by the specified stream object.

Return value

This function returns HRESULT.


The handle GetHGlobalFromStream returns may be different from the original handle due to intervening GlobalReAlloc calls.

This function can be called only from within the same process from which the byte array was created.


Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps | UWP apps]
Minimum supported server Windows 2000 Server [desktop apps | UWP apps]
Target Platform Windows
Header combaseapi.h
Library Ole32.lib
DLL Ole32.dll

See also