Solved

Testing Service Apps

Posted on 1998-10-28
2
298 Views
Last Modified: 2008-02-01
I can write a service app, and override DoStart in the Service object (Correct?).

But How do I test it?  When it runs, it should beep 4 times with a second's gap between them.  It seems to run for 4 seconds then bomb out, but no beeps...?

  TService1 = class(TService)
  protected
    procedure DoStart; override;
  public
    function GetServiceController: PServiceController; override;
    { Public declarations }
  end;


procedure TService1.DoStart;
var
  i: Integer;
begin
  inherited;
  for i:=1 to 4 do
    begin
      Beep;
      Sleep(1000);
    end;
end;
0
Comment
Question by:bcrotaz
2 Comments
 
LVL 8

Expert Comment

by:ZifNab
ID: 1344858
brocatz,

If I were you I should look on this page for more information :

http://www.wilsonc.demon.co.uk/delphi.htm#NT Specific Components

Sorry, I can't help you more.

Zif.
0
 
LVL 4

Accepted Solution

by:
davidmwilliams earned 100 total points
ID: 1344859
 The easiest way to test a service app is to make another project (and you can manage both simultaneously using a project group in Delphi 4) that generates a normal executable, and has a form.
  Drop two buttons on the form, Start and Stop, and copy the body of your service code into the Start method handler.  If you do any special processing when your service terminates on request, put this in the Stop method handler.  Then, you can run your service like a normal app, and step through it properly, etc., as well as send messages to the screen.
  This worked great for me when I wrote a service to extract alarms from a SCADA package using OLE, and then fax and email messages to relevant people.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question