Partager via


GetHGlobalFromStream

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

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
Windows Embedded CE Windows CE 2.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

Automation Functions
CreateStreamOnHGlobal
IStream

Concepts

Determining Supported COM APIs

Other Resources

LocalReAlloc