GetHGlobalFromStream function

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

Syntax


WINOLEAPI GetHGlobalFromStream(
  _In_   IStream *pstm,
  _Out_  HGLOBAL *phglobal
);

Parameters

pstm [in]

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

phglobal [out]

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

Return value

S_OK

Indicates that 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 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.

Windows Phone 8: This API is supported.

Windows Phone 8.1: This API is supported.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps | Windows Store apps]

Minimum supported server

Windows 2000 Server [desktop apps | Windows Store apps]

Header

Ole2.h

Library

Ole32.lib

DLL

Ole32.dll

See also

CreateStreamOnHGlobal
GlobalReAlloc

 

 

Community Additions

ADD
Show:
© 2014 Microsoft