嗨,我是COM的初学者。我想在STA和MTA模式下测试一个COM DLL。我的第一个问题是:是否有可能COM对象支持STA和MTA? 现在我想下面的STA代码片段: // this is the main thread
m_IFoo;
CoInitializeEx(STA); // initialize COM in main thread
CreateInstance(m_IFoo);
我在我的项目中有一些代码,如下所示,这里STA线程的用法是什么? 我对STA的了解是单线程公寓,它只在使用COM组件时才需要,它在应用程序的主要条目中使用。 /// <summary>
/// The main entry point for the application.
///
/// Command line:
/// Leaf.exe /s