Service Anatomy

Services are started and stopped by the service control manager (SCM). In order for a module to start and stop like a service, it must register itself with this SCM.

main() and WinMain()

Services are also executable modules. Typically, service modules are constructed so that they can be launched both as a service and as an interactive process. Interactive process means a process that exists in the context of a desktop. Because services are also executable modules, they must have a main() or WinMain() entry point, just like all other executable modules. The purpose of the executable entry point is to initialize the service. Listing 10.2 shows how to initialize a service; that is, how to register the service's ServiceMain() routine ...

Get COM+ Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.