In Chapter 6, we examined the architecture of an ATL COM object. In this chapter, we'll look at the necessary support structure that ATL provides for serving COM objects to a client. ATL COM objects are contained in DLL or EXE modules. DLL modules are loaded in the process of the client, which is why they're called in-process (or in-proc) servers. An EXE module, which is sometimes called an out-of-process (or out-of-proc) server, runs in its own distinct process. In addition to the code for the COM objects themselves (which is your main focus as a developer), the module must provide the necessary infrastructure for the following concepts:
Fortunately, ATL provides a lot of code to help out in these areas. The ATL COM AppWizard uses this code to generate fully functional server modules to house your objects. In this chapter, we'll look at some of the wizard-generated code along with a lot of undocumented ATL features to determine how ATL handles the boilerplate grunge that the "cut and paste" approach typically generates in classic COM development.
Let's start by examining the heart of an ATL-based server: CComModule.