首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

小弟我发现套间模型无论选Single还是Apartment得到的都是STA

2013-10-01 
我发现套间模型无论选Single还是Apartment得到的都是STA我在VS2012ATL工程里面建立ATL简单对象的时候,在类

我发现套间模型无论选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

奇怪了,这两个选项对于生成的代码而言都是一样的吗? 如果我要生成MTA套间模型的组件,应该选哪个选项呢?
谢谢!
[解决办法]
看msdn吧,查CComObjectThreadModel

如果还有疑惑,建议看看inside atl

热点排行