CoMarshalInterThreadInterfaceInStream

Passes streams containing interfaces between different threads, and is a helper that allows you to pass interface pointers easily and correctly between threads.

HRESULT CoMarshalInterThreadInterfaceInStream(

REFIID riid,
//Interface exposed by the object to be marshaled
LPUNKNOWN pUnk,
//Points to the object to be marshaled
LPSTREAM * ppStm
//Output pointer to the stream interface
);

Parameters

riid

Specifies the interface that is to be marshalled.

pUnk

Points to the IUnknown of the object to be marshalled, thus specifying the object.

ppStm

[Out] On return, points to the stream containing the interface .

Return Values

S_OK

Output stream contains marshalled interface.

E_OUTOFMEMORY

There was not enough memory to complete the call.

E_INVALIDARG

One or more arguments are invalid.

Comments

CoMarshalInterThreadInterfaceInStream
is a helper function that facilitates passing streams containing interfaces between threads, although you could implement it yourself from existing APIs if desired. It creates a stream and passes it to CoMarshalInterface, then passes the pointer to that stream back to the caller. The stream it returns is guaranteed to behave correctly when different threads access it. The receiving thread can then call the corresponding helper function CoGetInterfaceAndReleaseStream to get the interface pointer and release the stream object.

See Also

CoGetInterfaceAndReleaseStream

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database