• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 171
  • Last Modified:

Windows NT Service

Hi, there
I've got a class for NT Service, and I implemented the NT service but I need some special feathers. they are the following:
1.the service needs to remember some parameters.
2.the service needs to restart after login.
3.the service needs to be still active even when user has logged off.

thanks in advance.
  • 2
1 Solution
1. Try to use the Registry to set and remember your parameters

2. Make a simple App that connects to the 'Service Control Manager' (SCM for short) and that does nothing than to restart your service. Put this simple app to the startup-folder on your local machine.
I think it should even be enought to write a batch file that does the job:

rem Begin of file RestartMyService.cmd
@echo off
net stop MyServiceName
net start MyServiceName
rem End of file RestartMyService.cmd

3. If your service is configured to start automatically (im the services tray at control panel), the service will always be active. It doesnt shut down when a user logs off, it will shut down when the whole system goes down. That's the nature of a service.

hope this helps and feel free to ask any further questions
speedupAuthor Commented:
Hi, Ashman
can I mail you my code for the clarity of the problem?
What I did is start the service and the service is still active even when user has logged off. but there're still some problems. the codes for class service is from CodeGuru.

I,m sorry, speedup.
Since I've got a fulltime-job as application developer and another job as network manager, I don't have enough time to walk intro the code of someone and try to fix bugs. I'll try my best to help you here at experts-exchange! If you have some code snippets that are making trouble, you can post it here.

So, lets go on...

1. What are the problems?
2. What would the service do if it would work correctly?
3. I haven't tried the codeguru-class for myself. Although some time ago I thought that I would use it, I used my old functions instead (which are base on the simple service example from VC, only much prettier).
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now