unit sj;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, SvcMgr, Dialogs;
type
TServiceJ =
class(TService)
procedure ServiceExecute(Sender: 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 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
ServiceJ: TServiceJ;
implementation
{$R *.DFM}
procedure ServiceController(CtrlCode: DWord);
stdcall;
begin
ServiceJ.Controller(CtrlCode);
end;
function TServiceJ.GetServiceController: TServiceController;
begin
Result := ServiceController;
end;
procedure TServiceJ.ServiceAfterInstall(Sender: TService);
begin
ShowMessage('
ServiceAfterInstall');
end;
procedure TServiceJ.ServiceAfterUninstall(Sender: TService);
begin
ShowMessage('
ServiceAfterUninstall');
end;
procedure TServiceJ.ServiceBeforeInstall(Sender: TService);
begin
ShowMessage('
ServiceBeforeInstall');
end;
procedure TServiceJ.ServiceBeforeUninstall(Sender: TService);
begin
ShowMessage('
ServiceBeforeUninstall');
end;
procedure TServiceJ.ServiceContinue(Sender: TService;
var Continued: Boolean);
begin
Beep;
end;
procedure TServiceJ.ServiceCreate(Sender: TObject);
begin
ShowMessage('
ServiceCreate');
end;
procedure TServiceJ.ServiceDestroy(Sender: TObject);
begin
ShowMessage('
ServiceDestroy');
end;
procedure TServiceJ.ServiceExecute(Sender: TService);
begin
Beep;
while not Terminated
do
begin
ServiceThread.ProcessRequests(False);
// wait for termination
Sleep(1);
end;
Beep;
end;
procedure TServiceJ.ServicePause(Sender: TService;
var Paused: Boolean);
begin
Beep;
end;
procedure TServiceJ.ServiceShutdown(Sender: TService);
begin
Beep;
end;
procedure TServiceJ.ServiceStart(Sender: TService;
var Started: Boolean);
begin
Beep;
end;
procedure TServiceJ.ServiceStop(Sender: TService;
var Stopped: Boolean);
begin
Beep;
end;
end.