Link to home
Start Free TrialLog in
Avatar of marhk51
marhk51

asked on

How to make a service start after logon ?

I have created a service in delphi which runs another application. The reason for this is because the application it runs needs to run as a more privileged user. The problem I am having is that the service runs and executes the application before the logon.

The question is; how can I make the service wait until a user has logged on ?
Avatar of Lukasz Zielinski
Lukasz Zielinski
Flag of Poland image

you can't user may never logon but all services with automatic startup must be started thats why user logon is independent from service startup.

i've seen somwhere in MSDN methods for signup for login/logoff notifications

ziolko.
Avatar of marhk51
marhk51

ASKER

so is there a way I can check if there is a user logged on from within the service before launching the app ?
about notifications see here:
http://msdn2.microsoft.com/en-us/library/aa380543.aspx
but it aint easy task.

you can make your service to go in loop until someone will logon.

ziolko.
Avatar of marhk51

ASKER

yes, where can I download these notification dlls and supporting documentation ?
if you know name and pass of user you want to be owner of process you might try createprocessasuser or createprocesswithlogon

ziolko
ASKER CERTIFIED SOLUTION
Avatar of developmentguru
developmentguru
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
(Your service will start like it always has, but you can wait to start the applicatioon until a user is logged in - or delay another 30 seconds... whatever you need)
Avatar of marhk51

ASKER

Thanks to everyone who responded.