OBJECT_ENTRY_AUTO
来源:互联网 发布:文明6 mac 迅雷下载 编辑:程序博客网 时间:2024/05/18 01:43
The ATLMacros sample demonstrates using the new ATL macros OBJECT_ENTRY_AUTO
. This replaces the BEGIN_OBJECT_MAP
/OBJECT_ENTRY
/END_OBJECT_MAP
combination.
The sample is based on the ATL Project created by the AppWizard. If you choose to follow the steps in this document to create your own application, then ensure that in the Application settings dialog you choose 'DLL project' and you must ensure that you uncheck the 'Attributed' checkbox, otherwise the code will be created using the new C++ Attributes for the COM classes.
In VC6 the Object Map BEGIN_OBJECT_MAP
/END_OBJECT_MAP
was used to list all the ATL classes in the server that implemented COM classes. The Object Map was located in the server .cpp file (where WinMain()
or DllMain()
functions were located). To add a class to the map, the OBJECT_ENTRY
macro was used. Object Maps provides support for the registration, initialization, and creation of a class.
In VC7 the OBJECT_ENTRY_AUTO
macro is used for this instead.
Syntax:
OBJECT_ENTRY_AUTO(clsid, class )
Parameters:
clsid [in]
The CLSID of a COM class implemented by the C++ class named class. class [in]
The name of the C++ class implementing the COM class represented by clsid. So now there is no Object Map. You simply place the object entry macros at global scope in the project and it does all the work for you. The AppWizard puts this macro to the end of the ATL class header file, so you have all your class code in one place. Previously (VC6) it was easy to forget to add a class to the Object Map. Now you have all your code in one place, so it is easy to reuse existing classes since you can just copy the files that implement it and add them to the project. No more messing around with OBJECT_ENTRY
macros.
The Sample Application
- OBJECT_ENTRY_AUTO
- OBJECT_ENTRY_AUTO的背后(AC2)
- ATL7中OBJECT_ENTRY_AUTO宏是如何实现com对象映射表
- ATL7中OBJECT_ENTRY_AUTO宏是如何实现com对象映射表
- 我们需要一个信念,远离浮躁与浮夸
- WS 之 2007年6月
- 函数调用:call
- 项羽何以输给刘邦?
- 四书之《论语》学习日记3
- OBJECT_ENTRY_AUTO
- 系 统 分 析 师 考 试 大 纲
- 郁闷ING
- 黑客如何用线程注射技术隐藏自己的病毒
- 关于注册mscomm程序的编写
- SQL 语法参考手册
- 第一天学习C#
- Java Generic 泛型 - Java 学习笔记 (24)
- webBrowser,控制页面、提交表单的两种方法