Marshals an interface pointer from one thread to another thread in the same process.
HRESULT CoMarshalInterThreadInterfaceInStream(
REFIID riid, //Reference to the identifier of the interface
LPUNKNOWN pUnk, //Pointer to the interface to be marshaled
LPSTREAM * ppStm //Address of output variable that receives the
// IStream interface pointer for the marshaled
// interface
);
This function supports the standard return value E_OUTOFMEMORY, as well as the following:
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 ppStm 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:
Windows NT: Use version 4.0 or later.
Windows: Use Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in objbase.h.
Import Library: Included as a resource in ole32.dll.
CoGetInterfaceAndReleaseStream