Delphi-Kylix
  Home arrow Delphi-Kylix arrow Page 2 - Creating a Windows Service in Delphi
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
DELPHI-KYLIX

Creating a Windows Service in Delphi
By: Jacques Noah
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 57
    2006-02-08

    Table of Contents:
  • Creating a Windows Service in Delphi
  • Let’s Create a Service
  • The Code
  • Installing/Uninstalling the Service
  • Entire Code for the Service Application

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    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).

    More Delphi-Kylix Articles
    More By Jacques Noah


       · Good article! This would help me get started in writing Services together with Indy...
       · I've provided the entire program in a zip archive for donwload. Enjoy!
       · i' very grateful to you, if u send me sample windows service application in...
       · Good Enough for me to start with servicesThanks.A little bit of more complicated...
     

    DELPHI-KYLIX ARTICLES

    - Delphi Wrapper Classes and XML
    - Delphi and the DOM
    - Delphi and XML
    - Internet Access: Client Service
    - Finishing the Client for an Internet Access ...
    - The Client for an Internet Access Control Ap...
    - User Management for an Internet Access Contr...
    - Important Procedures for an Internet Access ...
    - Server Code for an Internet Access Control A...
    - Constructing the Interface for an Internet A...
    - Building a Server Application for an Interne...
    - Building an Internet Access Control Applicat...
    - Client Dataset: Working with Data Packets an...
    - Using the Client Dataset in an N-Tiered Appl...
    - Using the Client Dataset in Two-Tiered Clien...






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
    Stay green...Green IT