Problem with ServiceAddService function in Installshield


Hi,

I have a console application and I want to put it in windows service. I use ServiceAddService to add and start the service.

However, the application just sit there and doing nothing. I try to run it as console and it's working.

So, in resume, my application does not do anything if it is started as service.

Maybe there is an error in my call to ServiceAddService?


Thanks
TungVanAsked:
Who is Participating?
 
cookreCommented:
By default, services have no visible console and are not associated with a visible desktop.

To be able to get visible output from a service, it must run under the SystemLocal security context and be typed as ownprocess and interactive.  That will cause the service to be associated with the default interactive desktop (i.e., it will have access most Window's messages if you start a message pump), allowing you display message boxes.  Even then, you'll have no console outout and no shell messages.
0
 
nayernaguibCommented:
Check the command syntax on the following page from the InstallScript Language Reference:

  http://helpnet.installshield.com/robo/projects/installshield11langref/ServiceAddService.htm

You can also check for the return value to determine if the ServiceAddService function has finished successfully or not.

_______________

  Nayer Naguib
0
 
nayernaguibCommented:
That's right. I misunderstood the question. I thought the authour could not "use" the service, and thought that this might be due to failure to install or start the service. But after re-reading the question, I can see that the author expects the service to output something to the console. cookre has the answer.

_______________

  Nayer Naguib
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.