unit svcExample12;


interface

uses
    Windows,
    Messages,
    SysUtils,
    Classes,
    Graphics,
    Dialogs,
    Controls,
    SvCom_NTService,
    ExtCtrls;

type
  TSampleService12 = class(TNTService)
    procedure SampleService1Start(Sender: TNtService;
      var DoAction: Boolean);
    procedure SampleService1Stop(Sender: TNtService;
      var DoAction: Boolean);
  private
    { Private declarations }
    Timer: TTimer;
    procedure TimerOnTimer(Sender: TObject);
  public
    { Public declarations }
  end;

var
  SampleService12: TSampleService12;

implementation

{$R *.DFM}


procedure TSampleService12.TimerOnTimer(Sender: TObject);
begin
    Beep;
end;

procedure TSampleService12.SampleService1Start(Sender: TNtService;
  var DoAction: Boolean);
begin
    Timer:=TTimer.Create(nil);
    Timer.OnTimer:=TimerOnTimer;
end;

procedure TSampleService12.SampleService1Stop(Sender: TNtService;
  var DoAction: Boolean);
begin
    Timer.Free;
    Timer:=nil;
end;

end.

