Introduction
Service applications always have the same skeleton. Therefore, it would be
nice to have a service wizard integrated with the Visual Studio IDE (Integrated Development Environment).
My service wizard was created by the "Custom Wizard" project type. Its output is
an AWX file that should be copied to <Visual Studio directory>\Common\MSDev98\Template folder.
Therefore, when creating service projects, choose "Service Wizard" from the project type list.
One wizard step
As seen from the image above, there are 3 parameters for service installation:
- Displayed service name - This is the text that will be displayed when opening the service control manager.
- Startup type.
- Should the service interact with the desktop?
Install and uninstall your service
The wizard writes down code for installing and uninstalling your service.
Running your executable with the '/Install' or '/Uninstall' parameter will install or uninstall the service, respectively.
Debugging your service
Since the created project (by the wizard) is a console application, you can debug
your service as if it were just a console application and not a service.
TO DO ...
Your application code should be in the method Run()
located in service.cpp file.
Look for the comment // TO DO: Add code here
. This is the place where the service is running.
Updates
- 9.Apr.2003 - Send
WM_QUIT
message on service stop request. - 18.Jan.2004 -
- Start the service automatically when the service is installed and defined to have automatic startup.
- Wait for the service to be stopped when uninstalling the service.
Enjoy...
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.