How to Convert Process to Service
-
Hi What I wanna no is that can a compiled exe when double clicked is launched as SERVICE is there any API related to that hope somebody will reply soon!!
pitchu
I'll assume that you're talking about managed code here. Regular applications have an entry point that gets called when they are run. Services, on the other hand, may not be started by double clicking them because they typically don't have that standard application entry point. Instead, they have an entry point that the service control manager (SCM) understands. The SCM is what starts and stops service processes. It's fairly easy to convert one to the other. However, does your app have a user interface (this even includes message boxes)? If so, it's not a good candidate to run as a service. If you want to see how to make a service, there's a good template service project in VS. There's also a good article here[[^](http://a good article here)] on how to make a version of a service that can be debugged.
-
I'll assume that you're talking about managed code here. Regular applications have an entry point that gets called when they are run. Services, on the other hand, may not be started by double clicking them because they typically don't have that standard application entry point. Instead, they have an entry point that the service control manager (SCM) understands. The SCM is what starts and stops service processes. It's fairly easy to convert one to the other. However, does your app have a user interface (this even includes message boxes)? If so, it's not a good candidate to run as a service. If you want to see how to make a service, there's a good template service project in VS. There's also a good article here[[^](http://a good article here)] on how to make a version of a service that can be debugged.
Thnks for comment But what im trying to do is that im writing a program (say a program which never allows Solitare application to execute as im lab Administrator) but i want that program to be loaded as service for 2 reasons: 1. I dont want it to be enlisted in Task Manager 2. I want to learn to create services and convert process to service and vice-versa hoping some reply soon
pitchu
-
Thnks for comment But what im trying to do is that im writing a program (say a program which never allows Solitare application to execute as im lab Administrator) but i want that program to be loaded as service for 2 reasons: 1. I dont want it to be enlisted in Task Manager 2. I want to learn to create services and convert process to service and vice-versa hoping some reply soon
pitchu
This is better handled by Group Policy, not an application. You can't stop an .EXE from launching, you can only scan the Process list once in a while and quit the app if you find it.
wasim ahmad bhat wrote:
1. I dont want it to be enlisted in Task Manager
Services don't hide from Task Manager. There's nothing you can do to hide from the Task List.
wasim ahmad bhat wrote:
2. I want to learn to create services and convert process to service and vice-versa
Then learn how to write Console apps. You can use them to test the main code of your service, then, if done properly, you can write the service manager code around that. There really isn't any path to "convert" an app to a service or the other way around. Both types of applications are purpose written to be what they are, and do not lend themselves to be "converted" as you put it.
Dave Kreskowiak Microsoft MVP - Visual Basic
-
This is better handled by Group Policy, not an application. You can't stop an .EXE from launching, you can only scan the Process list once in a while and quit the app if you find it.
wasim ahmad bhat wrote:
1. I dont want it to be enlisted in Task Manager
Services don't hide from Task Manager. There's nothing you can do to hide from the Task List.
wasim ahmad bhat wrote:
2. I want to learn to create services and convert process to service and vice-versa
Then learn how to write Console apps. You can use them to test the main code of your service, then, if done properly, you can write the service manager code around that. There really isn't any path to "convert" an app to a service or the other way around. Both types of applications are purpose written to be what they are, and do not lend themselves to be "converted" as you put it.
Dave Kreskowiak Microsoft MVP - Visual Basic
Agreed I have 2 search the process list and quit the application Thanks for letting me know that there is no way to convert service to process and vice-versa Further, Im confused with those services loaded by svchost.exe which is not shown by task manager. im trying to do the same thing but how i dont know. Can u post some little code in VB6(preferably as im in fine touch now) or VC++ of the SERVICE and a methode to invoke it
pitchu
-
Agreed I have 2 search the process list and quit the application Thanks for letting me know that there is no way to convert service to process and vice-versa Further, Im confused with those services loaded by svchost.exe which is not shown by task manager. im trying to do the same thing but how i dont know. Can u post some little code in VB6(preferably as im in fine touch now) or VC++ of the SERVICE and a methode to invoke it
pitchu
VB6 can't make a service. It can make a normal Windows app, but it has to be written specially to be able to run LIKE a service using a 3rd party control. You can find out more here[^]. SVCHOST is a generic service "shell", or host process, that loads and executes services in .DLL files. A single instance of SVCHOST can host multiple services at the same time. These types of services you would have to write in VC++.
Dave Kreskowiak Microsoft MVP - Visual Basic
-
VB6 can't make a service. It can make a normal Windows app, but it has to be written specially to be able to run LIKE a service using a 3rd party control. You can find out more here[^]. SVCHOST is a generic service "shell", or host process, that loads and executes services in .DLL files. A single instance of SVCHOST can host multiple services at the same time. These types of services you would have to write in VC++.
Dave Kreskowiak Microsoft MVP - Visual Basic
Lots of Thanks A Nice and Resourceful link Hats OFF It will take me a week to purely understand the content Stay tuned Again LOTS OF THANKS By the way would u like 2 help me in my older question Difference in various types of DLLs as i hav no reply for that yet
pitchu