ATL Services


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on

The latest version of this topic can be found at ATL Services.

To create your ATL COM object so that it runs in a service, simply select Service (EXE) from the list of server options in the ATL Project Wizard. The wizard will then create a class derived from CAtlServiceModuleT to implement the service.

When the ATL COM object is built as a service, it will only be registered as a local server, and it will not appear in the list of services in Control Panel. This is because it is easier to debug the service as a local server than as a service. To install it as a service, run the following at the command prompt:

YourEXE .exe /Service

To uninstall it, run the following:

YourEXE .exe /UnregServer

The first four topics in this section discuss the actions that occur during execution of CAtlServiceModuleT member functions. These topics appear in the same sequence as the functions are typically called. To improve your understanding of these topics, it is a good idea to use the source code generated by the ATL Project Wizard as a reference. These first four topics are:

  • The CAtlServiceModuleT::Start Function

  • The CAtlServiceModuleT::ServiceMain Function

  • The CAtlServiceModuleT::Run Function

  • The CAtlServiceModuleT::Handler Function

The last three topics discuss concepts related to developing a service: