I tried the sample SERVICES, but I don't succeed.
This is what I did.
In service_install.prg I hardcoded cUser and cpass. For cUser I added the .\, so cuser is '.\chris'.
I start the following: service_install i -> this installs SERVICE.EXE, it comes into the services list in task manager. Is is marked as stopped.
Then I start: service_install s -> this should start the service, but nothing happens.
If I right-click in the taskmanager on my service, I have the option to start the service manually. When I try this i get the message 'Cannot start the service' and 'access denied'.
When I execute: service_install u -> this uninstall the service. This takes some time, but after about 15 seconds, the service disappears from the list in taskmanager.
I checked the documentation and looked at the source code. There is the following:
Code: Select all
oCtrl := ServiceController()
oCtrl:addController( cServiceName , ;
"eXpress++ Services Sample" , ;
cLocation + cServiceName + ".exe" , ;
cUser, cPass, /*parameter*/ , ;
oLog )
Code: Select all
DO CASE
CASE cFlag == "i"
ServiceController():install( cServiceName )
CASE cFlag == "s"
ServiceController():start( cServiceName )
CASE cFlag == "x"
ServiceController():stop( cServiceName )
CASE cFlag == "u"
ServiceController():uninstall( cServiceName )
OTHERWISE
Usage()
Quit
ENDCASE
Code: Select all
DO CASE
CASE cFlag == "i"
oCtrl:install( cServiceName )
CASE cFlag == "s"
oCtrl:start( cServiceName )
CASE cFlag == "x"
oCtrl:stop( cServiceName )
CASE cFlag == "u"
oCtrl:uninstall( cServiceName )
OTHERWISE
Usage()
Quit
ENDCASE
What am I doing wrong?