Simple NT Service.

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.

Thanks,

John.
LVL 6
JaymolAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
EpsylonConnect With a Mentor Commented:
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
0
 
EpsylonCommented:
I think this link will help you:

http://www.jgsoftware.com/nt.htm
0
 
geobulCommented:
Look for 'service applications-threads' in Delphi help. There is a sample with a thread and explanation.

Regards, Geo
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
JaymolAuthor Commented:
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,

John.
0
 
JaymolAuthor Commented:
Ta.  Just what I wanted.

John.
0
 
EpsylonCommented:
Why a C grade
0
 
JaymolAuthor Commented:
Don't be greedy.
0
 
EpsylonCommented:
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.
0
All Courses

From novice to tech pro — start learning today.