Lesson 1
Using ATL to build in-process COM Server
Development Frameworks
Most of our time has been spent studying COM's core concepts. We are now moving towards a study of standard COM implementation practices. Most, if not all, COM developers use a development framework to support their development efforts. The most popular C++-based development frameworks are the Microsoft Foundation Classes (MFC) and the Active Template Library (ATL). ATL is the focus of our study. A development framework differs from a class library in that it defines the structure of an application or component. Developers add code by "hooking" the framework. In ATL this means that you provide an application-specific class that derives from classes in the framework,
and override virtual functions from the base classes. When the framework code calls these functions, the call is directed into your code.
Additionally, ATL requires specific data structures at the global and class levels. ATL makes it very easy to add these structures via a set of high-level macros.
Visual C++ provides code-generators for ATL - an "App-Wizard" and an ATL-class tool. Using these a skeleton COM server and COM object can be created. You can simply fill in the methods generated by the tools.
This allows you to concentrate on the details of developing application code, instead of worrying about all the COM and ATL code.
However, I highly recommend that you take the time to understand and differentiate between what the tools do and what ATL does.
In other words, analyze the code generated by the tools, try to develop a basic understanding of ATL's core classes and how they support COM.
I believe that these efforts will really pay-off when you need to customize and deploy advanced ATL-based COM solutions.
In modules 2 and 3, we studied core COM and implementation practice concepts.
This module discusses how to use the active template library (ATL) to build an in-process server containing a COM object with two interfaces.
At the end of the module, you will be able to:
- Describe the role of the ATL framework
- Explain what ATL's core classes do
- Use the ATL COM-Wizard to generate an in-process COM server
- Add your own COM implementation classes into the ATL framework
- Add COM properties and methods into your COM objects
ATL is designed to simplify the process of creating efficient, flexible, lightweight controls. This module leads you through the creation of an ActiveX control, demonstrating many ATL and COM fundamentals.
COM Server