CkService C++ Class Reference (Visual C++)

CkService

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.

Properties

bool get_AutoStart(void);
void put_AutoStart(bool newVal);

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).

void get_DisplayName(CkString &str);
void put_DisplayName(const char *newVal);

The display name of the service.

void get_ExeFilename(CkString &str);
void put_ExeFilename(const char *newVal);

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

void LastErrorHtml(CkString &str);

Error information in HTML format for the last method called.

void LastErrorText(CkString &str);

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

void LastErrorXml(CkString &str);

Error information in XML format for the last method called.

void get_ServiceName(CkString &str);
void put_ServiceName(const char *newVal);

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

bool get_Utf8(void) const;
void put_Utf8(bool b);

To be documented soon...

Methods

bool Disable();

Disables a Windows service.

Returns true for success, false for failure.

bool Install();

Installs a Windows service.

Returns true for success, false for failure.

int IsAutoStart();

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

int IsDemandStart();

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

int IsDisabled();

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

int IsInstalled();

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

int IsRunning();

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

bool SaveLastError(const char * filename);

Saves the last error information to an XML formatted file.

bool SetAutoStart();

Configures an already-installed service for auto-start.

Returns true for success, false for failure.

bool SetDemandStart();

Configures an already-installed service for demand-start.

Returns true for success, false for failure.

bool Start();

Starts a service.

Returns true for success, false for failure.

bool Stop();

Stops a service.

Returns true for success, false for failure.

bool Uninstall();

Uninstalls a service.

Returns true for success, false for failure.

const char * displayName();

The display name of the service.

const char * exeFilename();

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

const char * lastErrorHtml();

Error information in HTML format for the last method called.

const char * lastErrorText();

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

const char * lastErrorXml();

Error information in XML format for the last method called.

const char * serviceName();

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