Differences between components and objects
First, identify the differences between components and objects. A component is a reusable module that consists of a set of processing processes, data encapsulation, and user interfaces (Rules Object ). The component looks like an object, but does not conform to the academic Definition of the object. Their main differences are:
- A component can be used in another application called a container (sometimes called a container or host) or as an independent process;
- A component can be composed of one class, multiple classes, or a complete application;
- Components are module reuse, while objects are code reuse. Currently, popular component models include COM (Component objiect module, object component model), DCOM (Distributed COM, distributed object component model), and CORBA (Common Object Request Broker Architecture, public Object Request proxy architecture ). At this point, the topic com related to this article has appeared, while the topic "CORBA" has nothing to do with this article and will not be introduced.
Differences between MFC and ATL
Currently, MFC and ATL represent two frameworks for different types of Windows-based development.
- MFC represents a simple and consistent method for creating an independent windows application. ATL provides a framework to implement the sample file code required to create a COM Client and a server.
- ATL is different from MFC. It is completely oriented to com components, and its technical route is also different from MFC. MFC uses conventional technologies such as inheritance, encapsulation, and nesting in C ++, however, ATL uses C ++ templates, multi-inheritance and other advanced technologies, and even uses STL. Therefore, learning and using ATL requires us to be familiar with these C ++ advanced features.
On the other hand, the ATL Structure is fully targeted at many standards in COM, which requires that the user must have a good understanding of the COM norms before they can really use ATL well.
What is ATL
ATL is the abbreviation of ActiveX Template Library (Dynamic Template Library). It is a set of C ++ Template Library. The basic goal is to automate COM application development as much as possible.
ATL is the abbreviation of ActiveX Template Library. It is a set of C ++ Template libraries. With ATL, you can quickly develop efficient and concise code (proactive and Slim code), and provide automatic code generation and visualization support for the development of COM components to the maximum extent. For ease of use, Microsoft has integrated ATL into the Visual C ++ development environment since Microsoft Visual C ++ 5.0. Visual Studio September 1998 launched in 6.0 integrates with ATL 3.0. Currently, ATL has become an important member of Microsoft standard development tools and is increasingly valued by C ++ developers.
- The basic goal of ATL is to automate com application development as much as possible. This basic goal determines that ATL only provides support for com development. The goal is to make ATL fully support the COM technology. ATL supports any stage and process of COM development and integrates many tools related to com development into a unified programming environment. ATL also provides comprehensive wizard support for various COM/ActiveX applications. All of these greatly facilitate the use of developers, so that developers can focus on the logic related to the application itself.
- ATL uses specific basic implementation technologies to get rid of a large amount of redundant Code. The Code of the COM application developed by ATL is concise and efficient, that is, the so-called "slim code ". In terms of implementation, ATL tries its best to adopt optimization technology, and even provides an alternative part of the C startup code that all C/C ++ programs must possess internally. At the same time, the code generated by ATL does not need to depend on a large code module similar to that required by the MFC program. the functions contained in the final module are the most basic and necessary. These measures enable the COM component (including ActiveX Control) developed by ATL to implement the Distributed Component Structure of the application in the network environment.
- Each version of ATL has good support for various new COM-based component technologies of Microsoft, such as MTS and ASP, and the response speed of ATL to new technologies is much faster than that of MFC. ATL has become the main development tool for Microsoft to support COM application development. Therefore, new developments in COM technology will be reflected in ATL in a short time. This allows developers to Use ATL for COM programming to obtain the same flexibility and powerful functions as programming using com sdk directly.