Click to See Complete Forum and Search --> : stopping service on logoff..!


mahanare
June 13th, 2003, 12:44 PM
Hi, I want to know how to stop a service on log off and how to start it on logoff.

I know abt SERVICE_CONTROL_SHUTDOWN, which is useful in shutdown case..
but what should i do in case of logoff/login..

thanx
HarinatH

Matthias Kring
June 16th, 2003, 10:12 AM
The intention of a service is just to keep running wihthout having someone to be logged on. So, it does not provide a state for being stopped and started at logon/logoff.

So, maybe you can run your service as a normal program that is started from the startup group of a user. And, normal programs are terminated automatically when a user logs off.

If necessary, you could write another service that watches whether a user is logged on or not, and then starts/stops the other service ;-)

mahanare
June 16th, 2003, 11:20 AM
Ok, thanx for the info..
may be that's why i didn't find any help from MSDN regarding this..
there is something like SERVICE_CONTROL_SHUTDOWN to handle shudown.

OK Take care