Chilkat C# Service Class Reference

Service

Provides the ability to programmatically install and uninstall Windows Services. Start and stop services. Modify start-properties (auto-start, demand-start, disabled). Query to find out if a service is running or already-installed, etc.

Object Creation

(C#)
Chilkat.Service obj = new Chilkat.Service();
(VB.NET)
Dim obj As New Chilkat.Service()

Properties

public bool AutoStart {get; set; }

true if the service should be auto-started when the computer starts, or false if the service should demand-started (not started at system startup time).

public string DisplayName {get; set; }

The display name of the service.

public string ExeFilename {get; set; }

The absolute path + filename of the service's EXE.

public string LastErrorHtml {get; }

Error information in HTML format for the last method called.

public string LastErrorText {get; }

Error information in plain-text format for the last method called.

public string LastErrorXml {get; }

Error information in XML format for the last method called.

public string ServiceName {get; set; }

The name of the service (no SPACE chars allowed, should be alpha-numeric).

Methods

public bool Disable();

Disables a Windows service.

Returns true for success, false for failure.

public bool Install();

Installs a Windows service.

Returns true for success, false for failure.

public int IsAutoStart();

Returns 1 if the service is configured for auto-start, 0 if not, and -1 if it was not possible to check.

public int IsDemandStart();

Returns 1 if the service is configured for demand-start, 0 if not, and -1 if it was not possible to check.

public int IsDisabled();

Returns 1 if the service is disabled, 0 if not, and -1 if it was not possible to check.

public int IsInstalled();

Returns 1 if the service is already installed, 0 if not, and -1 if it was not possible to check.

public int IsRunning();

Returns 1 if the service is already installed and running, 0 if not, and -1 if it was not possible to check.

public bool SaveLastError(string filename);

Saves the last error information to an XML formatted file.

public bool SetAutoStart();

Configures an already-installed service for auto-start.

Returns true for success, false for failure.

public bool SetDemandStart();

Configures an already-installed service for demand-start.

Returns true for success, false for failure.

public bool Start();

Starts a service.

Returns true for success, false for failure.

public bool Stop();

Stops a service.

Returns true for success, false for failure.

public bool Uninstall();

Uninstalls a service.

Returns true for success, false for failure.