ATL Development   «Prev  Next»
Lesson 7 ATL project files
Objective Describe the ATL project files.

ATL Project Files

Our project has the following files.
Phbook files consists of Source Files, Header Files, Resource Files, External Dependencies
PhBook files consists of Source Files, Header Files, Resource Files, External Dependencies

PhBook.cpp

PhBook.cpp contains (DLL-based) server functions DllMain, DllCanUnloadNow, DllGetClassObject, DllRegisterServer, and DllUnregisterServer. It also contains the global declaration of CComModule in variable _Module and the object map.

PhBook.def

PhBook.def exports required functions from the DLL.

PhBook.idl, PhBook.h, PhBook.tlb

PhBook.idl, PhBook.h, and PhBook.tlb contain interface definitions for IReadPhBook and IManagePhBook, type library PHBOOKLib, and COM class PhBookObj.

PhBook.rc, Resource.h, PhBookObj.rgs

PhBook.rc, Resource.h, and PhBookObj.rgs contain our application's resources. These include the compiled type library (PhBook.tlb), version information, a registry resource (discussed below), and a string table.

Project Resources

Files PhBook.rc and Resource.h define our project's resources. Like many MS-Windows development projects, we include version and string resources.
A type library can also be included as a resource. Our type library is embedded within the DLL as a binary resource.
PhBookObj.rgs is a registration script. A registration script contains commands that describe how to register our COM objects. The registration script is compiled into a binary resource and included in the executable file. The ATL framework uses the script to register and unregister the server's objects.
Macro DECLARE_REGISTRY_RESOURCEID
(IDR_PhBookObj) in PhBookObj.h adds a method called UpdateRegistry into a COM class. UpdateRegistry is used by the ATL framework to register or unregister a COM object using the registration script.

PhBookObj.cpp, PhBookObj.h

PhBookObj.cpp and PhBookObj.h contain the declarations and code for CPhBookObj.

Stdafx.cpp, StdAfx.h

Stdafx.cpp and StdAfx.h define several constants and include other files.

Precompiled COM files

Precompiling files can reduce compilation times, resulting in faster edit, compile, link, and debug cycles. The general idea is to precompile header and implementation files that do not change and reuse the compiled code, instead of recompiling the same files for each source code module in the project. The ATL COM AppWizard automatically sets up precompiling of the standard ATL files by designating file StdAfx.cpp to be precompiled through file StdAfx.h. This produces a precompiled header file (*.pch) using the project name, for example, PhBook.pch.
See the Visual C++ documentation for more details.
They are used to build a precompiled header file PhBook.pch.
Visual C++ 6.0 users will see also see file basetsd.h under External Dependencies. This file handles 64-bit wide types and values. We will not use 64-bit types in this course.