ServiceStatusConstants
The runtime-state values a service reports to the SCM through ServiceManager.ReportStatus. The same numeric values are returned by ServiceState.CurrentState (typed as a plain Long) and rendered as text by ServiceState.CurrentStateText.
The values mirror the Win32 SERVICE_* state constants. The vb prefix is a historical hold-over from VB6’s coding conventions.
| Constant | Value | Description |
|---|---|---|
| vbServiceStatusStopped | 1 | The service is not running. Set by the service immediately before EntryPoint returns; also the initial state the SCM stores when the service is registered. |
| vbServiceStatusStartPending | 2 | The service is starting up. Set by the package’s dispatcher trampoline before it calls EntryPoint; services with long start-up sequences should also re-report this state periodically together with a WaitHint so the SCM does not declare the service hung. |
| vbServiceStatusStopPending | 3 | The service has acknowledged a stop request and is shutting down. Typically reported from ChangeState immediately on receipt of vbServiceControlStop. |
| vbServiceStatusRunning | 4 | The service has reached steady state. Reported from EntryPoint once initialisation is complete; this is what services.msc shows as “Running”. |
| vbServiceStatusContinuePending | 5 | The service has acknowledged a continue request and is resuming. Reported from ChangeState on vbServiceControlContinue. |
| vbServiceStatusPausePending | 6 | The service has acknowledged a pause request. Reported from ChangeState on vbServiceControlPause. |
| vbServiceStatusPaused | 7 | The service has reached the paused state. Reported from EntryPoint once the pause loop is active. |
The typical state sequence for a simple service: vbServiceStatusStartPending (package) → vbServiceStatusRunning (from EntryPoint) → vbServiceStatusStopPending (from ChangeState) → vbServiceStatusStopped (from EntryPoint, before returning).