Solved

Testing Service Apps

Posted on 1998-10-28
2
289 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now