Programming Guide:xppguide

Implementing services Foundation

This section discusses the basic functionality of a service application. Please refer to the class description of ServiceApp() for details, further reading and an example.

Service startup

Ordinary applications are started by double clicking their icon. The operating system then loads the application into memory, spawns a new process and calls the initial procedure or function. The application then gains control over the new process.

Services work in a similar way. Instead of double clicking an icon, however, the operating system's Service Control Manager spawns a new process, forces the executable to be loaded and calls the executable's entry point. After this, the SCM waits for an acknowledgement from the service.

If there is no acknowledgement within a certain period of time (usually 30 seconds) the Service Control Manager kills the service process and raises the message that the service does not respond.

When a service has acknowledged its startup procedure, it changes its state to Running and can be controlled by the SCM until the service is terminated.

Callbacks for Control Requests

Since a service application can be controlled by the SCM, it must know how to react to Control Requests received by the SCM. For example, a service application must know what functions or procedures to execute as a reaction to a Stop and StartControl Request. That means, a service application must register callbacks prior to returning control back to the SCM.

Only after callback functions are registered, a service application can return control to the SCM. The SCM then calls the function registered as the entry point of the service.


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.