Why is it so hard to make a service in NT based systems? It really shouldn't be that difficult.
Sorry. Just had to say it.
Printable View
Why is it so hard to make a service in NT based systems? It really shouldn't be that difficult.
Sorry. Just had to say it.
It is not that hard, really is pretty easy. Check out this attachment.;)
Hello.
I was convinced to install Win2K. And am now confused on how secure it is.
One friend mentioned servieces (how strange to run across this in the forum.) Could you explane to me what this attachement does?( seoptimizer2001 )
Thanks seahag
This code allows you to install your application as a service. Meaning that once installed you can view its properties in the services menu of administrative tools. This allows you to choose whether or not your application will interact with the desktop, meaning that it can completely run undetected by the user. Also, you are able to select what occurs in the event the application fails, i.e. whether it should restart or execute another file. Also, a service can be set to start on start up and can also run while no user is logged into a machine.
Swoosh ~~noise of it going over my head~~ Swoosh
I dont even know what to ask next.
What can i do with that code then (example)
Where can I learn more?
:(
Thanks seoptimizer2001. I'll have to try an figure out how that code works. It seems a little odd, but maybe because i've never dealt with this before.
Any tips would help.
This code is actually very simple to use. I wish I remembered where I got it. What you need to do is first include this form in your project and make it your startup form. Then change the display name to whatever name you want to refer to this service and put a command at the end of the Form_Load event to load your actual first form that the user sees. Complie your app and now you are ready to install the service. From a command prompt navigate to the directory the .exe resides using the change directory function. Then type the name of the .exe and -install, ex. text.exe -install. Likewise you use -uninstall to uninstall the service. Now you can view your service and its properties in your services menu found in Administrative Tools. Good Luck, let me know if you have any problems.;)
Oh, yeah, don't forget to register the ntservice control!:D
1 more thing..
What are the advantages of this other that being running all the time and being invisible..
That is all .
Well, it doesn't have to run invisibly, you can decide whether or not it can interact with the desktop. I see two major advantages and reasons why I have used services in the past. One, it can run with out a user being logged in. And two, you are able to set recovery options for the service if it fails. Meaning that you can trap and error, if it is a 'fatal' error then you can exit the program and the service will restart itself in a minute. This is perfect when you have an app that needs to be able to run unattended 24/7.
yumm, hehe
I remember I was trying to close some programs in win2k and it didn't give me permission to close them ( from the task manager).
If your program is a service, can you do the same?
I am not sure about that, I have never tried. I will have to check on one of the boxes that is running my services to find out. I know that the way they are set up now, I can stop the program from task manager.
Okay, but then how does the user load the program? It'll run as a service, but how do i get the user into the prgram if it's wrapped up by your install service code.
Could i not make this into a seperate file that installs/uninstalls my app?
You could make a batch file that would install/uninstall the service. But in most cases a program that runs as a service is not one that a user is going to interact with. After you install the service, you will need to go into the services menu to select the properties of the service. Now you program can be run just as any other program is run even if it is not installed as a service, just needs to be installed if that is what you want it to do. I really wish I remembered where I got a lot of this code from, because it explained it a lot better. It probably can do more that what I have used it for.
Well my app does have a interface for the user to edit the settings and such. So i would need something for them to make alterations with.
Then in this case let the service interact with the desktop, which will put an icon on the task bar to allow the user's interactions.