JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Immediate Solutions: Using the ServiceBase Class

The ServiceBase class is the base class for a Windows service. Here is the inheritance hierarchy of this class:

Object
   MarshalByRefObject
      Component
         ServiceBase

You can find the more notable public properties of ServiceBase objects in Table 25.1 and their more notable protected methods in Table 25.2. (This class has no non-inherited events.)

Table 25.1: Noteworthy public properties of ServiceBase objects.

Property

Means

AutoLog

Specifies whether to record Start, Stop, Pause, and Continue commands in the event log.

CanPauseAndContinue

Gets/sets if you can pause and resume the service.

CanShutdown

Gets/sets if the service should be informed at system shutdown.

CanStop

Gets/sets if the service can be stopped.

EventLog

Gets an event log you can use to write to.

ServiceName

Gets/sets the name used to identify the service.

Table 25.2: Noteworthy protected methods of ServiceBase objects.

Method

Means

OnContinue

Executes when a service resumes after being paused.

OnPause

Executes when a service pauses.

OnPowerEvent

Executes when the computer's power status changes, as when notebooks go into suspended mode.

OnShutdown

Executes when the system is shutting down.

OnStart

Executes when the service starts.

OnStop

Executes when a service stops running.

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor