unit main;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, SvcMgr, Dialogs, serv;
type
TService1 =
class(TService)
procedure ServiceAfterInstall(Sender: TService);
procedure ServiceBeforeUninstall(Sender: TService);
procedure ServiceStart(Sender: TService;
var Started: Boolean);
private
_serv: TServ;
public
function GetServiceController: TServiceController;
override;
end;
var
Service1: TService1;
implementation
{$R *.DFM}
procedure ServiceController(CtrlCode: DWord);
stdcall;
begin
Service1.Controller(CtrlCode);
end;
function TService1.GetServiceController: TServiceController;
begin
Result := ServiceController;
end;
procedure TService1.ServiceAfterInstall(Sender: TService);
begin
DoStart;
end;
procedure TService1.ServiceBeforeUninstall(Sender: TService);
begin
DoStop;
end;
procedure TService1.ServiceStart(Sender: TService;
var Started: Boolean);
begin
_serv := Tserv.Create(self);
end;
end.