Simple NT Service.

Posted on 2001-06-25
Last Modified: 2010-05-18
Could someone give me a basic sample of an NT service please.  I've never written one, looked into writing one, or even considered it before now, but I need to do one.  So, if someone could, I'd just like a simple service example that includes the code for handling starting, stopping, and doing something in between.

I do want code for this please, and any explanation of the process if possible.


Question by:Jaymol
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
LVL 13

Expert Comment

ID: 6223888
I think this link will help you:
LVL 17

Expert Comment

ID: 6223899
Look for 'service applications-threads' in Delphi help. There is a sample with a thread and explanation.

Regards, Geo

Author Comment

ID: 6223912
Thanks for the suggestions guys, but I really do want someone on here to give me a code sample and explain it to me.  I can't get that from a bunch of links.

Thanks again,

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 13

Accepted Solution

Epsylon earned 100 total points
ID: 6224072
Ok, here we go

File menu > Close All
File menu > new > Service Application

Now you have a service that does absolutely nothing. It's like a normal Delphi project except that it has no forms (it uses TService instead of TForm). But you can still drop non-visual component in the 'Service1' window and use event etc. Beware that certain security restructions apply to services.
The rest is up to you.

To use (install) the service, type the following on the command line:

Project1 /install

(Don't forget to start the service)

And to uninstall

Project1 /uninstall

Author Comment

ID: 6224081
Ta.  Just what I wanted.

LVL 13

Expert Comment

ID: 6224089
Why a C grade

Author Comment

ID: 6224094
Don't be greedy.
LVL 13

Expert Comment

ID: 6224113
Hey, I am using MY time trying to solve YOUR problems. When I get a C-grade, I think that my comments where not good enough. Next to that I didn't even propose any of my comments a answer.

It just doen't look very gratefull to me.

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Create a path if not exists 7 108
Tidtcpserver listening on multiports? 1 45
enhance the following code 3 42
Twebbrowser add css to the header 3 39
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

733 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