Most examples in the web are not correct! Writing a service is a lot about understanding the state machines involved (between SCM, service handler in the service and the operating system). Most frameworks try to abstract too much and set values to defaults they don't understand (for instance startup groups and order, service dependencies). We should try to get to a set of service functions as for the daemon. The normal foreground mode in the console should also be possible and act on events. Sadly there is no easy way to catch a ProcessTerminate as it tears down all threads and the process. As long the service is started in the console or by double-click in the explorer there is no problem. Good links: - console_event_handling.txt: how to handle the events in foreground/ console mode - the Sphynx searchd.cpp (http://www.sphinxsearch.com/): especially service description, console events - POCO (http://pocoproject.org/): on some design questions - Microsoft Knowledge Base: best source as always - ModuleDD.txt: good introduction to the history of Windows services and how they work