For unmanaged processes, you control the model of the apartment used for the flow, passing the appropriate parameters CoInitializeEx(). Larry Osterman wrote a great reference:
...
When the stream calls CoInitializeEx(or CoInitialize), the stream tells COM which of the two types of apartments is prepared for acceptance. To indicate that the stream should live in the MTA, you pass a flag COINIT_MULTITHREADED CoInitializeEx. To indicate that the stream should have an STA, either call CoInitializeor pass a COINIT_APARTMENTTHREADEDflag CoInitializeEx.
...
- http://blogs.msdn.com/larryosterman/archive/2004/04/28/122240.aspx
source
share