DelphiFAQ Home Search:
General :: Programming :: Delphi :: Delphi IDE
Information about the Delphi IDE, add-in experts and wizards.

Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Only the 40 most recently viewed articles are shown.
You can see the full list here.

Featured Article

How to write a Windows NT Service (Delphi 5)

Question:

How can I turn a regular Delphi application into a service for a Windows NT4 server?
The meaning for this is that the program should run when the server is rebooted and even when the server is not logged on. So putting the program in startup folder is not enough.

Answer:

With Delphi 5, this has become very simple.
Just go to 'File' -> 'New' -> 'Service Application'.
It will create a regular project source with one main 'form', which is derived from TService.

The TService class encapsulates a Windows NT service in an NT service application. A service is accessed via the Service Control Manager. It is usually started during boot time or manually in the control panel 'Services' applet.

The code will look as shown in the example below and consult the online help about TService. You may want to handle the OnExecute event.

type
   TService1 = class(TService)
   private
     { private declarations }
   public
     function GetServiceController: TServiceController; override;
   end;
 

Generated 0:01:51 on Nov 20, 2017