ATL Development   «Prev  Next»
Lesson 2 Development frameworks
Objective Describe the role ATL plays as a development framework.

Development Frameworks (ATL role)

Using Visual C++ 5.0 or 6.0, we have three different ways to develop COM components. We can use the manual method, the Microsoft foundation classes (MFC), or ATL.

The manual method

The previous modules partially demonstrated the manual method, which is basically working without a development framework. Instead of a development framework, we write code that:
  1. Sets up our C++ implementation classes for class factories, COM objects, and interfaces
  2. Implements required in-process functions such as DllGetClassObject and DllRegisterServer
This gives us the most control, but also takes a lot of development effort--i.e., we spend much time working on repetitive development tasks such as registration, class factory support, and IUnknown code. Development frameworks like MFC and ATL provide built-in Data Driven implementations of these tasks.


MFC is not specifically designed to support COM. Although adding support for COM objects is not hard, using MFC also involves understanding and using the document/view architecture. This is far more functionality than we need or often want!


ATL is specifically designed to support development of COM objects and servers. It provides a lightweight class hierarchy that adds little extra overhead. Additionally, Visual C++ provides the ATL COM-Wizard to generate skeleton COM servers and class creation tools to support adding COM objects and methods.
ATL is an application framework, not a class library. Unlike a class library, an application framework defines and controls the structure of an application. You add application-specific functionality by defining a class at a specific location in the class hierarchy. For example, your class must inherit from one or more classes in the framework. Additionally, in an application framework, you often override specified functions. Framework code will call into your code directly or via polymorphism (i.e., virtual functions that you override) to hook your code into the framework.