[DUG] basic Service question

Dave O'Brien dave at ICCS.CO.NZ
Fri Oct 9 10:50:55 NZDT 2009


Something like this?

var
  Stopped: Boolean = false ;

procedure TsvcSomeService.ServiceExecute(Sender: TService);
var
  t: TDateTime ;
begin
  try
    t := now - 720 ;
    While (not terminated) and (not stopped) do
    begin
      if now > t + (1/1440) then // Run once a minute
      begin
        // Do something
        t := now ;
      End ;
      Sleep(1000) ; // Sleep to allow other services time...
    end ;
  except
  end ;
end;

procedure TsvcSomeService.ServiceStart(Sender: TService;
  var Started: Boolean);
begin
  Started := True ;
  Stopped := False ;
end;

procedure TsvcSomeService.ServiceStop(Sender: TService;
  var Stopped: Boolean);
begin
  Stopped := True ;
end;

procedure TsvcSomeService.ServiceCreate(Sender: TObject);
begin
  // Create some stuff
end;

procedure TsvcSomeService.ServiceShutdown(Sender: TService);
begin
  Stopped := True ;
end;

-----Original Message-----
From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz]
On Behalf Of Robert martin
Sent: Friday, 9 October 2009 10:34 a.m.
To: NZ Borland Developers Group - Delphi List
Subject: [DUG] basic Service question

Hi

I am trying to create a service 9never done this before) and following
some old instructions I found on the web.  The suggest creating a
service then installing it with service.exe /install then adding code
and debuggin.  I am failing at the most basic point.  I am trying to
install on Vista from cmd line.  It just comes up with a 'program is not
responding message.

Any help would be appreciated :)
Rob

_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi at delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:
unsubscribe

No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.421 / Virus Database: 270.14.7/2422 - Release Date:
10/08/09 06:39:00



More information about the Delphi mailing list