Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Start a Windows Forms application from a Windows Service

Start a Windows Forms application from a Windows Service

Scheduled Pinned Locked Moved C#
winformsquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    usermans
    wrote on last edited by
    #1

    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?

    L J 2 Replies Last reply
    0
    • U usermans

      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?

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      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] }


      1 Reply Last reply
      0
      • U usermans

        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?

        J Offline
        J Offline
        justintimberlake
        wrote on last edited by
        #3

        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

        U 1 Reply Last reply
        0
        • J justintimberlake

          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

          U Offline
          U Offline
          usermans
          wrote on last edited by
          #4

          Thanks, and yes I'd really like to know how to do it programmatically.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups