我发现套间模型无论选Single还是Apartment得到的都是STA
我在VS2012ATL工程里面建立ATL简单对象的时候,在类向导的最后一步,我发现不论是默认的"Apartment"选项还是选择第一个"Single",生成的代码都是这样的:
#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
#endif
using namespace ATL;
// CMySingle
class ATL_NO_VTABLE CMySingle :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CMySingle, &CLSID_MySingle>,
public IMySingle