ATL is the activity template library. It is a set of template-Based C ++ classes. Using these classes, you can easily create small and fast Component Object Model (COM) objects. It has
Special support for functions, including: Common Implementation of iunknown, iclassfactory, iclassfactory2, and idispatch; dual interface; standard com enumeration interface; Connection
Contacts; Separate interfaces; ActiveX controls.
[[
It seems that ATL is a good choice for Developing COM with C ++!
]
ATLCodeIt can be used to create a single-threaded object, a unit model object, a free-threaded model object, or an object that is both a free-threaded and a unit model.
The template has some macros. Like using a macro, the call template will show it (with appropriate parameters replaced) as the Code that has been written. However, the template goes further than this, and it allows
Create a new class as the type passed by the parameter. These new classes can execute the operations represented in the template code in a type-safe method.
The difference between a template library (such as ATL) and a traditional C ++ class library is thatSource code(Or as source code with a small amount of support for running), and in
Essentially, there is no inherent hierarchy or there is no need for a hierarchy. Instead of deriving from the class to obtain the required functions, the class is instantiated from the template.
ATL allows you to easily create COM objects, automated servers, and ActiveX controls. ATL provides built-in support for many basic com interfaces.
As an applicationProgramSource code is provided. ATL also makes a DLL (atl71.dll) available, which contains code that can be shared among multiple components. However
DLL is not necessary.
[[
I read some books about com and said: COM is just a standard, and its format is usually a DLL! But it is not a DLL!
What other forms are there?
]
Use ATL
ATL is a quick and easy way to use C ++ to create COM components and save space. If you do not need all built-in functions provided by MFC, Use ATL to create controls.
Use MFC
MFC allows you to create fully functional applications, ActiveX controls, and activity documents. If you have already created a Control Using MFC, you may need to continue development with MFC.
When creating a new control, if you do not need all the built-in functions of MFC, You Can Use ATL.
[[
Haha, it seems that ATL is much better than MFC! At least the volume is dominant!
However, there may be some positive problems here. ATL: Activity template library and basic MFC class library! All are class libraries! ATL and MFC are parallel! Don't joke!
]
The Active Template Library (ATL) is a set of template-Based C ++ classes to simplify the compilation of small and fast COM objects.
[[
ATL is a ready-made class library that is provided to programmers for the purpose of compiling COM objects!
]
Use the "application settings" page of the ATL Project Wizard to design and add basic functions for the new ATL Project.
Attribute-based
Default value. Create an ATL project using properties. After this option is selected, the module attribute is inserted into the. cpp file of the project. This property automatically implements dllmain,
Dllregisterserver, dllunregisterserver, dllgetclassobject, and dllcanunloadnow. The ATL Project Wizard generates two projects: a framework supporting Properties
Atl dll Project (called projname) and proxy/stub (stub) project (called projnameps ).
Attribute projects do not allow MFC to support and merge proxy/stub (stub) code.
By default, other ATL wizard that inserts objects and controls into the project uses attribute-based code.
Server Type
Select one of the three server types:
Dynamic link library (DLL)
Select to create an in-process server.
Executable File (exe)
Select to create a local out-of-process server. This option is not supported by MFC or COM + 1.0. It does not allow merging of proxy/stub (stub) code.
Service (exe)
Select to create a Windows application that runs in the background when Windows is started. This option is not supported by MFC, COM + 1.0, or by merging proxies/stubs (
Stub) code.
Additional options
Note that all additional options only apply to DLL projects.
Allow merging proxy/stub (stub) Code
Select the "allow merging proxy/stub (stub) code" check box to facilitate sending and processing interfaces. This option places the agent generated by midl in the same dll as the server
And (stub) code.
Support for MFC
Select to specify the object that is supported by MFC. This option links projects to the MFC library so that you can access any classes and functions they contain.
Support for COM + 1.0
Select to modify the project generation settings to support the COM + 1.0 component. In addition to the standard library list, the wizard also adds the COM + 1.0 component-specific library comsvcs. Lib
In addition, mtxex. dll delays loading on the main system when the application is started.
Supports component registration. If the ATL Project contains support for COM + 1.0 components, you can set this option. The component Registrar allows the COM + 1.0 object to obtain the component list and note
Volume components or logout components (individually or simultaneously ).
Learn from msdn