Method ServiceController():start() Foundation

This class method starts the service.

Syntax
:start( <cName> ) --> lSuccess
Parameters
<cName>
Name of the service to be started.
Return

This class method calls the instance method :logSuccess() and returns .T. (true) when the service is sucessfully started, otherwise it calls the instance method :logError() and .F. (false) is returned.

Description

This class method instructs the Service Control Manager (SCM) to start the service with the specified name. For a successful start of a service several preconditions must be met:

Account

Before the service can be started, the Service Control Manager (SCM) must pass a login procedure with the account of the service. Therefore, the account must have the privilege to Log on as Service.

Environment

The account under which the service is started must be configured accordingly. One problem, for instance, is the network environment. It must be ensured that the account has access to the resources it requires. For instance, all services programmed with Xbase++ require the Xbase++ runtime libraries. These libraries may safely reside on a network drive for normal GUI applications. A service application may be installed without username and password. This implies that the service will be started under a special account named LOCAL ACCOUNT. The local account does not have access to network drives so any attemp to start the service will fail.

Location

When an ordinary application is started, it may be assumed that the current location is the path where the executable of the application resides. This is not the case for a service application. However you may query the path where the executable resides during runtime. Use the ServiceController class and after you have added an instance of the controller by calling :addController() retrieve the control instance with :getUpdatedControl() . Thereafter you can query the executable path by inspecting the member variable :pathName.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.