I am writing a C # application that should run as a service, but also have user interaction. I understand that services do not have a user interface, etc. Therefore, I divided my program into a Windows form application and a service that can communicate with each other.
The problem I am facing is that I need a service to make sure that the Windows form application is always running and reloads it if it is not. I can determine if it is running and restart it with the following code in Windows 2000 / XP:
System.Diagnostics.Process.Start("ExePath");
but in Vista, it launches a new process as a local / system process that is invisible to the user. Has anyone got around this? Is there a way to determine which user is currently logged in and start a new process as that user? At the moment, I donโt need to consider fast user switching. Something - nothing - basic would be enough.
I would be grateful for any help or advice that you have on this issue.
I need to clarify that when installing the service, I set the "Allow the service to interact with the desktop" option. This allows you to work with 2000 / XP. However, Vista still has the above problem.
c # windows-vista winforms windows-services
Andrew Ensley
source share