After making a few various services in Delphi, I've realized that the TService
is lacking some of the necessary things which should come with a service application, such as logging, exception handling, and the 'Description' property in the registry.
I was wondering if it's possible for me to make my own service shell such as TJDService
which is inherited from a TService
but with some additional things, such as a 'Description' property showing in the object inspector. Can I make my own service shell like this? I know I can make my own "default project" inheriting from a TService
but that includes all my code with any new project.
When a new service is created, it should look like this:
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Classes, Vcl.SvcMgr,
JDServices;
type
TJDService1 = class(TJDService)
private
public
function GetServiceController: TServiceController; override;
end;
var
JDService1: TJDService1;
implementation
{$R *.DFM}
procedure ServiceController(CtrlCode: DWord); stdcall;
begin
JDService1.Controller(CtrlCode);
end;
function TJDService1.GetServiceController: TServiceController;
begin
Result := ServiceController;
end;
end.
Same as a typical service, but using my TJDService
instead of just TService
.