ATL introduction (1)
思伟
First, what is ATL
---- 1 . COM development and its locality
---- Since the first public online in 1993, after the first public cloth in 1993, the development model on the Windows platform gave birth to a huge change, and the WINDOWS programming was brought into component chemical time with COM-based a series of software components. When the company's software components that came for COM, the difficulties and annoying details of COM development technologies were also extremely incompetent. The COM programming is seen as a highly unparalleled technique, which is desirable. Fairman hopes to have a convenient COM development tool, improve the opening-up efficiency, and better use this technology.
---- Needle, Microsoft Division launched a COM SDK after pushing the COM SDK, taking a lot of time, and taking a lot of obend, especially in the MFC (Microsoft Foundation Class), the support of COM and OLE. But as the Internet, the distribution of components is required to ask the COM component to pass on the network, and we will weigh the Baobao's network bandwidth resources. The COM component developed by MFC is not well satisfied by the species limit. Therefore, this Microsoft has launched a new COM development tool in 1995 - -tl.
---- ATL is the abbreviation of ActiveX Template Library, which is a set of C templates. The use of ATL can quickly open the high-efficiency, simple code, and the maximum level of code automatically generates the maximum limit of the COM component. For the way, from Microsoft Visual C 5.0 version, Microsoft integrates the ATL to Visual C open environment. The Visual Studio 6.0 pushed in September 1998 became an ATL version 3.0. At the beginning, ATL has become a heavy member in Microsoft standard development tools, and is the focus of the C developers.
---- ATL actually brought what kind of benefit to the developer? This must first start from the COM from ATL.
---- In front of ATL production, there are two ways to develop COM components: First, use COM SDK to directly develop COM components, and another square is the COM support for MFC.
---- Direct the use of COM SDK to develop COM components is the most foundation. With the open packages for use Microsoft, we can directly write COM schemes. However, this difficulty and workload of this development method are very large. On the one hand, the developer is required to have a more in-depth understanding of the technology principles of COM (although the deep understanding of the technology itself is very beneficial to the use of any kind of tool. However, for a complete set of complex technologies such as COM, it is very difficult to master in a short period of time); on the other hand, use the COM SDK to ask developers to implement every detail of the COM application, complete a lot of repetition Sexual work. The result of this is that it is not only lowered by the work efficiency, and the development of the people will not put a lot of effort into the technical detail that should be used in use. Although this kind of developmental form is necessary for some special applications, this programming method does not comply with the reusability of the partition of the components, which is not a way to use COM SDK. ---- The COM supported by MFC can be used to use the COM SDK basis to improve the degree of automation, and the time is shortened. The MFC uses the square formula to face the COM's base function to enchannel C classes, and the developer has obtained the COM support capabilities through success. For the various characteristics of the COM object, there are many predefined macros in the MFC. These macros have the power of such macros to realize the definition of the COM interface and the functionality of the log in the COM object. The developer can use these macros to customize the characteristics of the COM object.
---- In addition, in the MFC, it is also available for the support for Automation and ActiveX Control. For these two, Visual C also provides corresponding AppWizard and ClassWizard support, which adds the COM application.
---- MFC's support for COM and OLE is indeed a lot of steps compared to hand workers. However, MFC's support for COM is still not complete and thorough. For example, if the IDL language defined for COM interface, MFC does not have any support. In addition, the new development of the new development of COM and ACTIVEX technology in recent years has not been given to the spiritual support. This is determined by the basic release of the MFC. The MFC is designed to develop the object-oriented package developed by the Windows platform. It naturally needs to involve Windows programming, COM is also supported by the MFC as a part of the programming development of Windows platform, but the support of MFC is based on its global target The starting point, so support for COM must obey its global goal. From this point of view, MFC's support for COM cannot be satisfied with the requirements of the developer. ---- With the development of Internet technology, Microsoft has vigorously promoted ActiveX technology as an important part of its network strategy, but uses MFC development ActiveX Control, the code redundancy is large, that is, the so-called "fertilizer code" (FAT " Code, and must depend on the MFC's runtime library to run correctly. Although the MFC's running moment only has a partial functionality to be related to COM, but is a reinforcement of MFC, ActiveX Control must be returned to this heavy burden. If you use a static connection MFC running time library, this will make the ActiveX Control code too large, which will occupy a valuable network bandwidth resource when transferring on the network; if you use a dynamically connected MFC running time library, this will ask the browser one side. Must have MFC's runtime library support. In general, MFC is also very uncomfortable in the environment of supporting COM technologies.
---- 2 . ATL's goal
---- Solution of the question in the COM-opening method is the basic goal of ATL.
---- First, ATL's basic goal is to make COM applications can be automatically automatically activated. This basic goal determines the ATL only to the COM to provide support. The goalat is made to make ATL's support for COM technologies. One of the annular and processes issued by COM, ATL is supported, and the many tools associated with COM development are integrated into a uniform programming environment. Various applications for COM / ActiveX, ATL also provides complete Wizard support. All of these greatly have the use of the developers, so that the developers can set the attention of the attention to the use of the body.
---- Second, ATL has a large amount of redundant code, and the COM applications that COM applications from ATL are simply practiced using ATL. ATL is now able to use optimization techniques, even in its internal, and the C / C process must have a substitute for C-start code. At the same time, the code of ATL production does not require the pour than the large-scale code module required by the MFC program, and the functionality containing the user is the most important and most necessary. These measures make the COM components (including ActiveX Control) developed by ATL, which can be constructed in the form of a partial assembly component applicable to the network. ---- Third, the various version of the ATL on Microsoft's COM-based all kinds of new components such as MTS, ASP, etc., ATL, ATL, the anti-response speed of new technologies is larger than MFC. The ATL has become a major to develop the COM application for Microsoft, so the new development of the COM technologies will be reflected in the ATL in a short time. This allows the developer to use ATL to enter the COM programming to obtain the same spiritual activity and powerful functions with the direct use of COM SDK programming.
---- The purpose of this article is that it is advisable to make readers in a limited space to make the readers have a first step in the use of ATLs, and to make a wide range of COM developers to develop the ATL to throw the jade.
Second, ATL basic skills
---- Although the use of ATLs to develop COM should be a non-simple simple matter, but it is a complex technique after the ATL simple interface. In the face of a large number of code generated by ATL, we can develop COM applications even if we don't understand the meaning of these codes, but if we have to fully explore the potential of ATL, develop more flexible, powerful COM applications, must The basic techniques used by ATL have aware of the basic techniques. The quality of the research ATL is the ATL source code provided by Visual C . This part of this article is just a simple introduction to the most basic technologies used in ATL.
---- Simply said that the basic techniques used in ATL include the following aspects:
COM technology C template technology (Template) C multi-succeed technology (multi-inheritance)
---- COM technology is the basis of the solution of ATL, which has the lowest limitations of the basic concept of COM technology with ATL. By the COM is a non-often complex positive technical system, it is limited to the parameters of this article, which is no longer described. For the COM basic concept mentioned in this article, do not do too much, please read the book of reference books. The template for the most core implementation technology of ATL is an extension of standard C language, but in most C programming environments, people rarely use it, because the template's function is very strong, but its internal mechanism is more complicated. It is necessary to use more C knowledge and experience to be flexible. The COBJECTARRAY such as the MFC is defined by the template. The full-class integral structure of the full passage is fixed, and the ATL is the most successful work. ---- The pattern of the template is simply a pair of abrasions. We know that the C language class defines the way constructor (herein the C object instead of the COM object), the object is an instance of the class, and the template class defines the construction of the class, which is generated using the template class definition. It is different. Because this can be said that the template class is "class". (Untonged to stay)
---- (author address: Research "of Beijing University Science and Technology Research Institute, 100871; Received: 1999.08)
---- Responsible for editing; Xu Ju Xu_jufang@ccw.com.cn
-