Compartilhar via


GetHGlobalFromStream (Compact 2013)

3/26/2014

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

Syntax

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

Parameters

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

Return Value

The following HRESULT values can be returned.

Value

Description

S_OK

Indicates that the handle was returned.

E_INVALIDARG

Indicates an 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 can differ from the original handle due to intervening LocalRealloc calls.

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

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

Requirements

Header

ole2.h

Library

ole32.lib

See Also

Tasks

Determine Supported COM APIs

Reference

OLE Functions
Automation Functions
CreateStreamOnHGlobal
IStream

Other Resources

LocalReAlloc