unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, SvcMgr, Dialogs,
ExtCtrls;
type
TService1 = class(TService)
Timer1: TTimer;
procedure ServiceStop(Sender: TService; var Stopped: Boolean);
procedure Timer1Timer(Sender: TObject);
procedure ServiceBeforeInstall(Sender: TService);
procedure ServiceAfterInstall(Sender: TService);
procedure ServiceContinue(Sender: TService; var Continued: Boolean);
procedure ServicePause(Sender: TService; var Paused: Boolean);
procedure ServiceStart(Sender: TService; var Started: 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('Installiert');
end;
procedure TService1.ServiceBeforeInstall(Sender: TService);
begin
Showmessage('Install wird gestartet');
end;
procedure TService1.ServiceContinue(Sender: TService; var Continued: Boolean);
begin
Timer1.Enabled:=true;
Showmessage('wiederaufgenommen');
end;
procedure TService1.ServicePause(Sender: TService; var Paused: Boolean);
begin
Timer1.Enabled:=false;
Showmessage('Pausiert');
end;
procedure TService1.ServiceStart(Sender: TService; var Started: Boolean);
begin
Timer1.Enabled:=true;
Showmessage('Gestartet');
end;
procedure TService1.ServiceStop(Sender: TService; var Stopped: Boolean);
begin
Timer1.Enabled:=false;
Showmessage('gestopt');
end;
procedure TService1.Timer1Timer(Sender: TObject);
begin
Showmessage('Aktion');
end;
end.