GetHGlobalFromStream

Retrieves the global memory handle to a stream that was created through a call to the CreateStreamOnHGlobal function.

WINOLEAPI GetHGlobalFromStream(
  IStream * pstm,     //Points to the stream object
  HGLOBAL * phglobal  //Points to the current memory handle for the 
                      // specified stream
);
 

Parameters

pstm
[in] IStream pointer to the stream object previously created by a call to the CreateStreamOnHGlobal function.
phglobal
[out] Points to the current memory handle used by the specified stream object.

Return Values

S_OK
Indicates the handle was successfully returned.
E_INVALIDARG
Indicates invalid value specified for the pstm parameter. It can also indicate that the stream object passed in is not one created by a call to the CreateStreamOnHGlobal function.

Remarks

The handle this function 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.

QuickInfo

  Windows NT: Use version 3.1 or later.
  Windows: Use Windows 95 or later.
  Windows CE: Unsupported.
  Header: Declared in ole2.h.
  Import Library: Included as a resource in ole32.dll.

See Also

CreateStreamOnHGlobal GlobalRealloc in Win32