Creating a Windows Service in Delphi - Let’s Create a Service
(Page 2 of 5 )
Our service is going to write the time and date to a text file every minute or so. So, start up Delphi and select File->New->Other. Then select "Service Application."

Add a timer, set it to 60000 (one minute), save the project and unit, and familiarize yourself with the code structure. As you’ve no doubt noticed, the application declaration is different from the standard application. Go to the object inspector and have a look at the various properties of the service application.
Let’s go through what each of them mean:
AllowPause and AllowStop properties are self explanatory. You need to set these to true.
DisplayName specifies the name of the service in the Service Control Manager or Task Manager; enter any name you want in here.
The Interactive property specifies whether the Service should be able to communicate with the desktop (for example, with ShowMessage). This will normally depend on what kind of service you are creating. For our service we will normally not need any interaction with the desktop, but for the purposes of this tutorial we will set it to true.
The ServiceStartName and Password properties specify the account that the service should be operating as.
The ServiceType is set to stWin32 for a Win32 Service, and the StartType property can be stAuto, stBoot, stDisabled, stManual, or stSystem (but for a Win32 service, only Auto, Manual, and System are relevant).
Next: The Code >>
More Delphi-Kylix Articles
More By Jacques Noah