TCnServiceController Class

Represents a Windows service and allows you to connect to a running or stopped service, manipulate it, or get information about it.

Namespace: CNClrLib.Component.ServiceController
TComponent
  CNClrLib.Control.Base.TClrBaseComponent
    CNClrLib.Component.ServiceController.TCnServiceController
type
 TCnServiceController = class(TClrBaseComponent)
 end;

The TCnServiceController type exposes the following members.

Show:
 NameDescription
Create(TComponent)

Creates and initializes a TCnServiceController instance. (Overrides TClrBaseComponent.Create(TComponent).)

Destroy

Frees the resources allocated with a TCnServiceController instance. (Overrides TClrBaseComponent.Destroy.)

Top
Show:
 NameDescription
CanPauseAndContinue

Gets a value indicating whether the service can be paused and resumed.

CanShutdown

Gets a value indicating whether the service should be notified when the system is shutting down.

CanStop

Gets a value indicating whether the service can be stopped after it has started.

DefaultClrObject

Get the common language runtime object interface for this component. (Inherited from TClrBaseComponent.)

DependentServices

Gets the set of services that depends on the service associated with this ServiceController instance.

DisplayName

Gets or sets a friendly name for the service.

MachineName

Gets or sets the name of the computer on which this service resides.

ServiceHandle

Gets the handle for the service.

ServiceName

Gets or sets the name that identifies the service that this instance references.

ServicesDependedOn

The set of services that this service depends on.

ServiceType

Gets the type of service that this object references.

Status

Gets the status of the service that is referenced by this instance.

Top
Show:
 NameDescription
Close

Disconnects this ServiceController instance from the service and frees all the resources that the instance allocated.

Continue

Continues a service after it has been paused.

Dispose

Releases the resources used by the Component. (Inherited from TClrBaseComponent.)

DoGetDefaultClrObject

Represents method DoGetDefaultClrObject. (Inherited from TClrBaseComponent.)

DoGetDotNetBaseComponent

Represents method DoGetDotNetBaseComponent. (Overrides TClrBaseComponent.DoGetDotNetBaseComponent.)

ExecuteCommand(Integer)

Executes a custom command on the service.

GetClrObject

Represents method GetClrObject. (Inherited from TClrBaseComponent.)

GetDevices

Overloaded. Retrieves the device driver services on the local computer.

GetDevices(String)

Overloaded. Retrieves the device driver services on the specified computer.

GetServices

Overloaded. Retrieves all the services on the local computer, except for the device driver services.

GetServices(String)

Overloaded. Retrieves all the services on the specified computer, except for the device driver services.

LoadServiceNames(TStrings)

Retrieves all the names of the services on the local computer, except for the device driver services.

Pause

Suspends a service's operation.

Refresh

Refreshes property values by resetting the properties to their current values.

RegisterEventCallBack(ClrWString,Pointer)

Add an event to the instance using the specified event name and function pointer which is the event handler. The RegisterEventCallBack method does not directly add the event handler to the event. A hooking mechanism is used such that if the event is fired, the hook event is also fired which in turn calls the function pointer. (Inherited from TClrBaseComponent.)

RegisterEventSource

Register the Delphi object which will raise the .Net event handler. (Inherited from TClrBaseComponent.)

Start

Overloaded. Starts the service, passing no arguments.

Start(TArray)

Overloaded. Starts a service, passing the specified arguments.

Start(_StringArray)

Overloaded. Starts a service, passing the specified arguments.

Stop

Stops this service and any services that are dependent on this service.

UnRegisterEventCallBack(ClrWString,Pointer)

Remove an event from the instance using the specified event name and function pointer which is the event handler. (Inherited from TClrBaseComponent.)

UnRegisterEventSource

Unregister the Delphi object which raised the .Net event handler. (Inherited from TClrBaseComponent.)

WaitForStatus(TServiceControllerStatus)

Overloaded. Infinitely waits for the service to reach the specified status.

WaitForStatus(TServiceControllerStatus,_TimeSpan)

Overloaded. Waits for the service to reach the specified status or for the specified time-out to expire.

Top

See C:\Users\Public\Documents\CrystalNet Technologies\.Net VCL for Delphi Demo Folder after installation for examples of how to use this component.