CServices class

This article was submitted .

A small MFC class that wraps the Windows NT Service API functions.

The class lets you control a service, just like the Services control-panel applet. This includes starting and stopping a service.


CreateCreates a new service.
DeleteDeletes a service.
StartStarts a service.
StopStops the service.
IsRunningIs the service running?
IsInstalledIs the service installed?
GetStateReturns the state of the service.
GetStateStringReturns the state text.
GetDisplayNameReturns the service's display name.
GetServiceNameReturns the internal name.
SendMessageSends a message to the service.
GetLastErrorReturns the last error code.

Source Code Dependencies

Microsoft MFC Library
My Global MFC functions

Download Files

DownloadSource Code (5 Kb)

To the top