Where's the Code?



One of the things that takes some getting used to about writing ATL servers is that they don't look like traditional programs. A COM server is really a collaboration between several disparate components:

  • Your application
  • The COM subsystem
  • ATL template classes
  • "IDL" code and MIDL Generated "C" headers and programs
  • The system registry

It can be difficult to look at an ATL based COM application and see it as a unified whole. Even when you know what it's doing, there are still big chunks of the application that you can't see. Most of the real server logic is hidden deep within the ATL header files. You won't find a single main() function that manages and controls the server. What you will find is a thin shell that makes calls to standard ATL objects.

In the following section we're going to put together all the pieces required to get the server running. First we will create the server using the ATL COM AppWizard. The second step will be to add a COM object and a Method. We'll write an In-Process server because it's one of the simpler COM servers to implement. An In-process server also avoids having to build a proxy and stub object.