GetHGlobalFromStream

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

WINOLEAPI GetHGlobalFromStream(
  IStream* pstm,
  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 Values

The following table shows the HRESULT values that can be returned by this function.

Value Description
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 this function returns may be different from the original handle due to intervening LocalRealloc calls.

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

To determine whether the platform supports this function, see Determining Supported COM APIs.

Requirements

OS Versions: Windows CE 2.0 and later.
Header: Ole2.h.
Link Library: Ole32.lib.

See Also

CreateStreamOnHGlobal | IStream | LocalRealloc | Determining Supported COM APIs

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.