CoMarshalInterThreadInterfaceInStream function (combaseapi.h)
Marshals an interface pointer from one thread to another thread in the same process.
HRESULT CoMarshalInterThreadInterfaceInStream(
[in] REFIID riid,
[in] LPUNKNOWN pUnk,
[out] LPSTREAM *ppStm
);
[in] riid
A reference to the identifier of the interface to be marshaled.
[in] pUnk
A pointer to the interface to be marshaled, which must be derived from IUnknown. This parameter can be NULL.
[out] ppStm
The address of the IStream* pointer variable that receives the interface pointer to the stream that contains the marshaled interface.
This function can return the standard return values E_OUTOFMEMORY and S_OK.
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:
- Creates a stream object.
- Passes the stream object's IStream pointer to CoMarshalInterface.
- Returns the IStream pointer to the caller.
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps | UWP apps] |
Minimum supported server | Windows 2000 Server [desktop apps | UWP apps] |
Target Platform | Windows |
Header | combaseapi.h (include Objbase.h) |
Library | Ole32.lib |
DLL | Ole32.dll |