Expand Minimize

CoMarshalInterThreadInterfaceInStream function

Marshals an interface pointer from one thread to another thread in the same process.

Syntax


HRESULT CoMarshalInterThreadInterfaceInStream(
  _In_   REFIID riid,
  _In_   LPUNKNOWN pUnk,
  _Out_  LPSTREAM *ppStm
);

Parameters

riid [in]

A reference to the identifier of the interface to be marshaled.

pUnk [in]

A pointer to the interface to be marshaled, which must be derived from IUnknown. This parameter can be NULL.

ppStm [out]

The address of the IStream* pointer variable that receives the interface pointer to the stream that contains the marshaled interface.

Return value

This function can return the standard return values E_OUTOFMEMORY and S_OK.

Remarks

The CoMarshalInterThreadInterfaceInStream function enables an object to easily and reliably marshal an interface pointer to another thread in the same process. The stream returned in the ppStm parameter is guaranteed to behave correctly when a client running in the receiving thread attempts to unmarshal the pointer. The client can then call the CoGetInterfaceAndReleaseStream to unmarshal the interface pointer and release the stream object.

The CoMarshalInterThreadInterfaceInStream function performs the following tasks:

  1. Creates a stream object.

  2. Passes the stream object's IStream pointer to CoMarshalInterface.

  3. Returns the IStream pointer to the caller.

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

Objbase.h

Library

Ole32.lib

DLL

Ole32.dll

See also

CoGetInterfaceAndReleaseStream

 

 

Community Additions

ADD
Show:
© 2014 Microsoft