AR Services Manager ActiveX Library 1.03

With this library you will be able to manage services in a NT system.asseen3.gif (1132 bytes)

History:

The classes included in this library are:

clsServices
This class can be used to list and access services in a system. You can specify what type of services to want to have listed.
Properties:
  • ComputerName as String. By default, this property is set to the name of the computer in which the library is running. You can specify the name of another computer to access the services running there.
  • Count as Long. Number of services listed.
  • Item (Index) as clsService. This property will take you to a clsService object that contains the properties and the methods to access the service specified. You can specify a service by putting the number that is has in the collection or by passing its name.
  • ServicesEnumState as enServiceEnumState. The possible values for this property are: [Active Services], [Both Active and Inactive Services] or [Inactive Services]. Specify here what type of services you want to list. The library will update itself if this property is changed.
  • ServicesEnumType as enServiceEnumType. The possible values for this property are: [WIN32 Services], [Kernel and File System Drivers] or [Both WIN32 and Drivers]. Specify here what type of services you want to have listed. The library will update itself if this property is changed.
Methods:
  • Delete (Index) as Boolean. Pass the number that a service has in the collection or the name of a service to delete it. The method returns True if successful or False if there was an error. After you delete a service, it is not inmediatelly removed from the services, if it has references to it. If you try to call the function again after you got True (successful), the method will return False.
  • Refresh as Boolean. Call this method to refresh the contents of the object. Returns True if successful or False if there was an error.

 

clsService

This class is returned by the clsServices class (one per service listed), but you can also use it independently to access a specific system, in the local machine or through a network. To access a specific service, just set the name or the display name of the service you want to access. The class will update itself automatically with the information of the service. Using this class you can also start, stop, pause or continue services.
(r/w) means read/write property; (r-o) means read-only property.

Properties:
  • AutoUpdate as Boolean (r/w). If this property is True, when you tell the service to change its state (stop it, start it, pause it...) the library will start checking for the state of the service till its state changes completelly or till the time specified in AutoUpdateTimeOut expires. This is because usually a service doesn't change its state inmediatelly, but needs some time for processing. Therefore, before when you changed the state of a service, the CurrentState property passed to something like [Start Pending], and after that you had to refresh the state manually. This property is automatically True if you are using this class independently, and automatically False if you are accessing from a clsServices class.
  • AutoUpdateInterval as Double (r/w). How often the library will refresh the status of the service, given in milliseconds.
  • AutoUpdateTimeOut as Double (r/w). If the service doesn't change its status, for how long the library should keep refreshing its contents, in milliseconds.
  • BinaryPathName (r/w). Path to the binary file of the service.
  • CheckPoint as Long.
  • ComputerName as String (r/w). By default, this property is empty if you are using this class independently, or has the same value as the class clsServices is this class is an item of the other. You can specify another name to access a service in another computer.
  • ControlsAccepted as enControlsAccepted (r-o). Possible values are: [Accept Pause & Continue], [Accept Shutdown] or [Accept Stop]. Also, it could be any combination of these values. To know if a service accepts a certain control, use an expression like this: CBool (Svc.ControlsAccepted And Accept Stop). If the expression returns True, then the service accepts the control Stop.
  • CurrentState as enServiceStatus (r/w). Possible values are: [Continue Pending], [Pause Pending], Paused, Running, [Start Pending], [Stop Pending] or Stopped. You can also set this property to Running, Stopped or Paused to modify the state of the service.
  • Dependencies as clsSVCDependencies (r/w). This property will return an object that contains the dependecies of the service, if any. You can also create this class independently and set it to this property to change the dependencies of the service.
  • DisplayName as String (r/w). Display name for the service (those you can see in the services control manager). If you change this property, the class will look for another service that has that display name, and if it finds it, it will update itself with the information of that service.
  • LoadOrderGroup as String (r/w).
  • Name as String (r/w). Internal name of the service. You can change this property to the name of other service, and the class will update itself with the configuration of that service.
  • Password as String (r/w). You can use this property to change the password of the account under which a service is run. If you do it, this property will also contain that password if the change is successful. If it is not, or you haven't changed the password, this property will be empty (what doesn't mean that the account doesn't have any password).
  • ServiceSpecificExitCode as Long (r-o).
  • ServiceType as enServiceType (r/w). Possible values are: [File System Driver], [Kernel Driver], [WIN32 Own Process], [WIN32 Share Process], [Interactive WIN32 Own Process] or [Interactive WIN32 Share Process].
  • StartErrorSeverity as enStartErrorSeverity (r/w). Possible values are: [Ignore Error], [Normal Error], [Severe Error] or [Critical Error]. Informs on how there server will act if an error ocurres at startup.
  • StartName (r/w). Depending on the type of service, this can be the name of the account under which the service is running.
  • StartType as enStartType (r/w). Possible values are: [Auto Start], [Boot Start], [Demand Start], Disabled or [System Start]. Indicates how the service is started.
  • TagID as Long (r/w).
  • WaitHint as Long (r-o).
  • Win32ExitCode as Long (r-o).
Methods:
  • ChangeAccount (strUserID As String, strPassword As String, [strDomain As String]) As Boolean. If you want to change the account under which a WIN32_OWN_Process service is run, you can't use the StartName and Password properties independently, since both must be changed at the same time. Use this method instead.
  • ChangeDisplayName (strDisplayName As String) As Boolean. You can't use the DisplayName property because if you change it, the class will just look for another service with that display name, instead of changing that property for the current service. Use this method instead.
  • ContinueService as Boolean. Use this method to continue the service if it is paused. Returns True of successful or False if an error ocurred.
  • PauseService as Boolean. Use this method to pause a service if it is running. Returns True of successful or False if an error ocurred.
  • StartService as Boolean. Use this method to start a service if it is stopped. Returns True of successful or False if an error ocurred.
  • StopService as Boolean. Use this method to stop a service if it is running. Returns True of successful or False if an error ocurred.
  • Refresh. Forces the library to update the information about the service. Returns True of successful or False if an error ocurred.
Events:
  • StateChanged (lNewState as enServiceStatus). This event is fired when the service changes its status.

 

clsSVCDependencies
This object is used to manage dependencies of the services.
Properties:
  • Count as Long. Number of dependencies being listed.
  • Item (lIndex as Long) as String. Pass a number and this property returns the dependency that has that number in the collection.
  • Source as String. This property returns a character 0 divided string with the dependecies. This is how they are originally given by the system.
Methods:
  • Add (strCad as String). Use this method to add a dependency to the object.
  • Remove (lIndex as Long) as Boolean. Use this method to remove dependencies from the object.

 

(31 Kb)

 

© Alvaro Redondo, 1998. All Rights Reserved.
http://www.sevillaonline.com/ActiveX/