Most ATL classes are template based. ATL is shipped as a set of source files. To use ATL classes, we include ATL's *.h and *.cpp files
in our project. For basic ATL projects, the core files we use are atlbase.h and atlcom.h. ATL files can be found in the Visual C++ ATL\include and ATL\src directories.
ATL provides built-in support for COM servers, class factories, and
. The general idea behind using ATL is to plug
your application classes into the ATL class hierarchy. You add one C++ class for each COM object in a server. Following are brief summaries of ATL core classes.
provides support for COM server functionality. It provides methods to register and unregister COM objects,
check server lock and references counts, and get class objects. All ATL-based programs have a global instance of
(or a class derived from it) called
. These methods call into internal methods in
(and its base class,
) provides an internal data-driven implementation of
, called from
provides a data-driven implementation of
An interesting feature of ATL is that your application classes are not the most derived classes! An instance of CComObject
derives from your class.
Normally, we do not manually code required in-process server functions (for example,
DllGetClassObject) or our COM object implementation classes.
Instead, we use the ATL COM AppWizard to generate a skeleton server and add our COM implementation classes using Visual C++ tools. This is the topic of the next lesson.