Windows Service App starting other apps
-
I am writing a windows service app to monitor for files that change. If I determine a file has changed I want to start another application that runs independent of the service app. Currently I have tried to use the Process.Start. When the newly started application encountered an error (that displays a message box) the error message ”It is invalid to show a modal dialog or form when the application is not running in UserInteractive mode. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application” was returned. I only want the service app to be responsible for starting the new application. How can I kick off the new application with no ties back to the service app?
-
I am writing a windows service app to monitor for files that change. If I determine a file has changed I want to start another application that runs independent of the service app. Currently I have tried to use the Process.Start. When the newly started application encountered an error (that displays a message box) the error message ”It is invalid to show a modal dialog or form when the application is not running in UserInteractive mode. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application” was returned. I only want the service app to be responsible for starting the new application. How can I kick off the new application with no ties back to the service app?
You have to go into the Service Control Manager and get the properties on your service. In there, under the Log On tab, make sure that "Allow service to interact with desktop" is turned on. If it's not, then your application doesn't run under the same desktop that the user sees. It'll run under a hidden desktop with no user interface. This is why your getting this error. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
You have to go into the Service Control Manager and get the properties on your service. In there, under the Log On tab, make sure that "Allow service to interact with desktop" is turned on. If it's not, then your application doesn't run under the same desktop that the user sees. It'll run under a hidden desktop with no user interface. This is why your getting this error. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
I understand why am getting the error. I don't want my service to interact with the desktop. How can my service start a new application so that the new application can interact with the desktop not my service? Thanks!
You have a choice: Either enable the service to interact with the desktop or don't launch applications that require a user interface. Think of it this way: The service has to have "interact" enabled to launch an application on the desktop. If this is not enabled, the applications that the service launches inherit the security context of the local SYSTEM account, which is running under an invisible desktop with no UI. If you enable the service to interact with the desktop, any applications launched by the service will inherit the security context of the User that's logged in on the visible desktop and, hence, your launched app will be visible. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
You have a choice: Either enable the service to interact with the desktop or don't launch applications that require a user interface. Think of it this way: The service has to have "interact" enabled to launch an application on the desktop. If this is not enabled, the applications that the service launches inherit the security context of the local SYSTEM account, which is running under an invisible desktop with no UI. If you enable the service to interact with the desktop, any applications launched by the service will inherit the security context of the User that's logged in on the visible desktop and, hence, your launched app will be visible. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome