unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, SvcMgr, Dialogs;
type
TService1 =
class(TService)
procedure ServiceAfterInstall(Sender: TService);
procedure ServiceAfterUninstall(Sender: TService);
procedure ServiceBeforeInstall(Sender: TService);
procedure ServiceBeforeUninstall(Sender: TService);
procedure ServiceContinue(Sender: TService;
var Continued: Boolean);
procedure ServiceCreate(Sender: TObject);
procedure ServiceDestroy(Sender: TObject);
procedure ServiceExecute(Sender: TService);
procedure ServicePause(Sender: TService;
var Paused: Boolean);
procedure ServiceShutdown(Sender: TService);
procedure ServiceStart(Sender: TService;
var Started: Boolean);
procedure ServiceStop(Sender: TService;
var Stopped: Boolean);
private
{ Private-Deklarationen }
public
function GetServiceController: TServiceController;
override;
{ Public-Deklarationen }
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
showMessage('
AfterInstall');
end;
procedure TService1.ServiceAfterUninstall(Sender: TService);
begin
showMessage('
AfterUninstall');
end;
procedure TService1.ServiceBeforeInstall(Sender: TService);
begin
showMessage('
BeforeInstall');
end;
procedure TService1.ServiceBeforeUninstall(Sender: TService);
begin
showMessage('
BeforeUninstall');
end;
procedure TService1.ServiceContinue(Sender: TService;
var Continued: Boolean);
begin
showMessage('
OnContinue');
Continued := True;
end;
procedure TService1.ServiceCreate(Sender: TObject);
begin
showMessage('
OnCreate');
end;
procedure TService1.ServiceDestroy(Sender: TObject);
begin
showMessage('
OnDestroy');
end;
procedure TService1.ServiceExecute(Sender: TService);
begin
showMessage('
OnExecute - begin');
while not Terminated
do
begin
ServiceThread.ProcessRequests(False);
end;
showMessage('
OnExecute - end');
end;
procedure TService1.ServicePause(Sender: TService;
var Paused: Boolean);
begin
showMessage('
OnPause');
Paused := True;
end;
procedure TService1.ServiceShutdown(Sender: TService);
begin
showMessage('
OnShutdown');
end;
procedure TService1.ServiceStart(Sender: TService;
var Started: Boolean);
begin
showMessage('
OnStart');
Started := True;
end;
procedure TService1.ServiceStop(Sender: TService;
var Stopped: Boolean);
begin
showMessage('
OnStop');
Stopped := True;
end;
end.