Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Windows NT Service

Posted on 1999-07-20
Medium Priority
Last Modified: 2013-11-20
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.
Question by:speedup
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
  • 2

Accepted Solution

ashman061699 earned 600 total points
ID: 1310566
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

Author Comment

ID: 1310567
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.


Expert Comment

ID: 1310568
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).

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

Question has a verified solution.

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

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

715 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