Start a Windows Forms application from a Windows Service
-
Hello, I was trying to make a Windows Service that monitors a certain condition and starts a Windows Forms application when the condition is met. I used the System.Diagnostics.Process.Start(@"c:\app.exe"); but whenever this line runs the application (the Windows Forms application) fails. I tried the same code to run the application "app.exe" from another Windows Forms applcication and it worked fine? Can anybody please tell me why is this happening?
-
Hello, I was trying to make a Windows Service that monitors a certain condition and starts a Windows Forms application when the condition is met. I used the System.Diagnostics.Process.Start(@"c:\app.exe"); but whenever this line runs the application (the Windows Forms application) fails. I tried the same code to run the application "app.exe" from another Windows Forms applcication and it worked fine? Can anybody please tell me why is this happening?
Hi, if your app has a GUI, it can only run when someone has logged on, unless you perform an "impersonation". You'll have to look that up, I don't know any details. :)
Luc Pattyn
try { [Search CP Articles] [Search CP Forums] [Forum Guidelines] [My Articles] } catch { [Google] }
-
Hello, I was trying to make a Windows Service that monitors a certain condition and starts a Windows Forms application when the condition is met. I used the System.Diagnostics.Process.Start(@"c:\app.exe"); but whenever this line runs the application (the Windows Forms application) fails. I tried the same code to run the application "app.exe" from another Windows Forms applcication and it worked fine? Can anybody please tell me why is this happening?
make sure ur service is desktop interactive i.e go to service(SCM) and right click ur service to see the property under logon tab check allow service to interact with desktop the ur System.Diagnostics.Process.Start(@"c:\app.exe"); will work. interaction can aslo be done programmaticalyy.do u want that also
-
make sure ur service is desktop interactive i.e go to service(SCM) and right click ur service to see the property under logon tab check allow service to interact with desktop the ur System.Diagnostics.Process.Start(@"c:\app.exe"); will work. interaction can aslo be done programmaticalyy.do u want that also