windows service to trigger another application

suddenelfilio

Well-known member
Joined
Jun 3, 2004
Messages
144
Location
Belgium
Programming Experience
5-10
Hello,

I've been building a program X that does some actions on another program Y. I wanted this program X only to be running when the program Y is running and stopped when the program Y is been stopped.

To do this I wrote a windows service that will be monitoring the running services to see if program Y is running. When it is I wanted to let the windows service start program X. This is being done.

The problem is that program X is being started using the same user credentials as the windows service is running in. This causes problems because I can't get to the User Interface of program X and it is also not performing the actions required when program Y is running.

My guess is that I will need to do some impersonation to get the program started using the currently logged on user.

Does anyone have an idea on how doing this? Or does someone have a different approch to my problem?

kind regards, Filip
 
I read this somewhere:
"You need to allow services explicitly to interact with the desktop "
Do it via control panel, services, properties, Log On page, checkbox.

Here is link to enable "interact with desktop" in code (check the comments about WMI approach also!):
http://www.codeproject.com/csharp/CsWindowsServiceDesktop.asp

The ServiceProcessInstaller didn't have this option in VS2003, and there is little services support in 2005 Express, so I don't know if this have been "simplified" there.
 
Back
Top