The services are not ordinary applications. For the
normal work the service should be registered in the system. The SvCom
application does all necessary registration calls if started with the
/install switch. Try to install our example. To do this go to the Run|Parameters
dialog and type the '/install' in the Parameters field.
Press OK and run application. You will see that it works
a couple of seconds and stops automatically without any notifications.
Important note: SvCom application does not show notification
window on successful installation or uninstallation unlike
the TService applications do it. So you will have no problems when you
distribute your SvCom applications and install it with a setup program.
OK, our service is installed now. To be sure of it go
to the Control Panel and select the Services applet. You will see the
name of our service 'SvCom Example N 1' in the list of services. Select
it and press the Start button. The service will start and you will hear
beeps. Now press a Stop button to stop it. Service stops and does not
beep now.
The service application can be started not only from the
control panel but from the Command Prompt too. Let's try it. Go to the
command prompt and type the command
NET START SAMPLESERVICE1
The last parameter is the name of our service module. This command is
case insensitive and I use the capital letters to highlight it only.
Press Enter and the service will start. You will hear a beeps again.
To stop it type the command
NET STOP SAMPLESERVICE1
and press Enter. Service will stop. (Note that "NET STOP ..."
and "NET START..." commands won`t work under Windows95/98. Use SvComSc
command line utility instead.)
Well, after playing enough with this first example we
should uninstall it. The thing is that this service was installed to
AutoStart mode by default and it will start automatically each time
after rebooting. And you will hear a beep, beep, beep, beep...
Let's uninstall it now. To do it run our application with
/uninstall switch. You can do it from the Delphi IDE as it were shown
above or from the command prompt. Just type the command
SVCOMEXAMPLE1 /UNINSTALL
and press Enter. The service will be uninstalled.
In future you will need to use one more SvCom switch I
mean the /reinstall switch. When SvCom application detects this switch
it uninstalls itself and installs again immediately. No exceptions occur
if the service was not installed before.
We have examined the process of creating, installing and
running the service application based on SvCom components. But there
is one more operation that is necessary during application development.
It is debugging. Special efforts were applied to do a debugging of SvCom
applications more easy. Next step shows how to debug SvCom application.