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. Windows Service interaction with Sys Tray icon

Windows Service interaction with Sys Tray icon

Scheduled Pinned Locked Moved C#
helpquestion
8 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.
  • J Offline
    J Offline
    JD86
    wrote on last edited by
    #1

    What would be the best way for a windows service to interact with a sys tray icon? I have found a lot of tutorials on systray icons interacting with a windows service but i think I need the reverse. Basically I have a systray icon that needs to run on a per-user basis. I have the systray icon and an installer which puts it under the Start Up folder for All Users. The problem is it won't start unless they log off and back on. Plus if for whatever reason it crashes or the process ends it won't start back up after that unless they log off and back on again. So I was thinking of a service that monitors each user on the system (some terminal servers) that makes sure that the certain process is running for each user.. if not then start that process for that user session. Any ideas?

    J L 2 Replies Last reply
    0
    • J JD86

      What would be the best way for a windows service to interact with a sys tray icon? I have found a lot of tutorials on systray icons interacting with a windows service but i think I need the reverse. Basically I have a systray icon that needs to run on a per-user basis. I have the systray icon and an installer which puts it under the Start Up folder for All Users. The problem is it won't start unless they log off and back on. Plus if for whatever reason it crashes or the process ends it won't start back up after that unless they log off and back on again. So I was thinking of a service that monitors each user on the system (some terminal servers) that makes sure that the certain process is running for each user.. if not then start that process for that user session. Any ideas?

      J Offline
      J Offline
      JD86
      wrote on last edited by
      #2

      Well after googling and not finding what I want I decided to post and right afterwards think I found it: http://msdn.microsoft.com/en-us/library/ms682429.aspx[^] Unless someone has a better idea?

      1 Reply Last reply
      0
      • J JD86

        What would be the best way for a windows service to interact with a sys tray icon? I have found a lot of tutorials on systray icons interacting with a windows service but i think I need the reverse. Basically I have a systray icon that needs to run on a per-user basis. I have the systray icon and an installer which puts it under the Start Up folder for All Users. The problem is it won't start unless they log off and back on. Plus if for whatever reason it crashes or the process ends it won't start back up after that unless they log off and back on again. So I was thinking of a service that monitors each user on the system (some terminal servers) that makes sure that the certain process is running for each user.. if not then start that process for that user session. Any ideas?

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        JD86 wrote:

        What would be the best way for a windows service to interact with a sys tray icon?

        It shouldn't; services are run before the user logs on, and there's no systray on the logon-desktop. If you 'must', I'd recommend having a second winform app that implements the systray-functionality, and have it communicate with the service.

        Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

        J 1 Reply Last reply
        0
        • L Lost User

          JD86 wrote:

          What would be the best way for a windows service to interact with a sys tray icon?

          It shouldn't; services are run before the user logs on, and there's no systray on the logon-desktop. If you 'must', I'd recommend having a second winform app that implements the systray-functionality, and have it communicate with the service.

          Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

          J Offline
          J Offline
          JD86
          wrote on last edited by
          #4

          The problem I have is this systray icon is a ticket application. People will use it to submit tickets to the help desk. So I need some way to make sure the icon is running for each and every user and always running. The way I have it right now it launches from the Startup folder when they log in. So if the application crashed (it shouldn't.. but you never know) or if the process was killed for some reason.... it won't be running anymore. Maybe i'm being overly cautious and the chances of it actually not running anymore are too slim to worry about.... You can't exit it from the context menu of the systray anyways.

          D L 2 Replies Last reply
          0
          • J JD86

            The problem I have is this systray icon is a ticket application. People will use it to submit tickets to the help desk. So I need some way to make sure the icon is running for each and every user and always running. The way I have it right now it launches from the Startup folder when they log in. So if the application crashed (it shouldn't.. but you never know) or if the process was killed for some reason.... it won't be running anymore. Maybe i'm being overly cautious and the chances of it actually not running anymore are too slim to worry about.... You can't exit it from the context menu of the systray anyways.

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            JD86 wrote:

            So if the application crashed (it shouldn't.. but you never know) or if the process was killed for some reason.... it won't be running anymore.

            This is where a second application is executing as the user, watching for the sys tray app. If the process terminates or doesn't respond, it gets kill and restarted. NOTHING that happens in a UI ever gets touched by a service. This is being strictly enforces starting with Windows Vista and even more so with Windows 7 and again with Windows 8.

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak

            1 Reply Last reply
            0
            • J JD86

              The problem I have is this systray icon is a ticket application. People will use it to submit tickets to the help desk. So I need some way to make sure the icon is running for each and every user and always running. The way I have it right now it launches from the Startup folder when they log in. So if the application crashed (it shouldn't.. but you never know) or if the process was killed for some reason.... it won't be running anymore. Maybe i'm being overly cautious and the chances of it actually not running anymore are too slim to worry about.... You can't exit it from the context menu of the systray anyways.

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              JD86 wrote:

              So if the application crashed (it shouldn't.. but you never know) or if the process was killed for some reason.... it won't be running anymore.

              OMG :omg: ..imagine, someone like me, cutting the power to the PC. Would the program still run? Is the app there to help me, or is it there to be some kind of nuisance? A task that is really 'unkillable' should prevent the PC from event rebooting, shouldn't it? What you say you make submitting a ticket very easy? With a nice webform and an easy to remember-url? Wouldn't that be providing more of a service?

              Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

              J 1 Reply Last reply
              0
              • L Lost User

                JD86 wrote:

                So if the application crashed (it shouldn't.. but you never know) or if the process was killed for some reason.... it won't be running anymore.

                OMG :omg: ..imagine, someone like me, cutting the power to the PC. Would the program still run? Is the app there to help me, or is it there to be some kind of nuisance? A task that is really 'unkillable' should prevent the PC from event rebooting, shouldn't it? What you say you make submitting a ticket very easy? With a nice webform and an easy to remember-url? Wouldn't that be providing more of a service?

                Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

                J Offline
                J Offline
                JD86
                wrote on last edited by
                #7

                I don't really get what you are trying to get out nor do I care for the way you are coming off. I work in a IT business. We have clients that we manage their computers. One thing that we want is a systray icon to make it easy for customers to submit a ticket. A Windows application is better in this case instead of a web application. For one the web application would let anyone use it (we don't want it). If we locked it down by username and password then that is just an extra step for the user (we don't want an extra step for the user). With a windows application a user can EASILY click a button to take a screenshot that has the error message on the screen. With a web application this would not be easy if possible (maybe with installing some active-x crap or something). With a windows application & systray icon a user can simply right click an icon on their desktop and choose "Create Service Ticket". With a web application they would have to type in the URL, click a shortcut on their desktop, wait for the page to load and submit the ticket. Now you are dealing with more overhead since you are using IE, Firefox or whatever browser you are using. Which in turn uses more memory. So if you want to get technical then a web form for submitting a ticket is less ideal than an application that we can push out with our monitoring service. Anyways I'm not going to worry about something to make sure the process is running at all times. I think it will be a rare occurrence when it isn't running anyways... so we can just deal with that when it comes. I appreciate the others that gave constructive feedback. Thank you.

                L 1 Reply Last reply
                0
                • J JD86

                  I don't really get what you are trying to get out nor do I care for the way you are coming off. I work in a IT business. We have clients that we manage their computers. One thing that we want is a systray icon to make it easy for customers to submit a ticket. A Windows application is better in this case instead of a web application. For one the web application would let anyone use it (we don't want it). If we locked it down by username and password then that is just an extra step for the user (we don't want an extra step for the user). With a windows application a user can EASILY click a button to take a screenshot that has the error message on the screen. With a web application this would not be easy if possible (maybe with installing some active-x crap or something). With a windows application & systray icon a user can simply right click an icon on their desktop and choose "Create Service Ticket". With a web application they would have to type in the URL, click a shortcut on their desktop, wait for the page to load and submit the ticket. Now you are dealing with more overhead since you are using IE, Firefox or whatever browser you are using. Which in turn uses more memory. So if you want to get technical then a web form for submitting a ticket is less ideal than an application that we can push out with our monitoring service. Anyways I'm not going to worry about something to make sure the process is running at all times. I think it will be a rare occurrence when it isn't running anyways... so we can just deal with that when it comes. I appreciate the others that gave constructive feedback. Thank you.

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  JD86 wrote:

                  nor do I care for the way you are coming off.

                  Sets the tone just nicely :)

                  JD86 wrote:

                  A Windows application is better in this case instead of a web application.
                  With a windows application a user can EASILY click a button to take a screenshot that has the error message on the screen. With a web application this would not be easy if possible (maybe with installing some active-x crap or something).

                  Good point. I pointed out the possibility of a simple webform, as a browser is even available on most phones. It's easily accessible, and has a low threshold for the user. You're right that screenshots are invaluable when providing assistance. Same goes for having TeamViewer on there and having access to the log-files.

                  JD86 wrote:

                  So if you want to get technical then a web form for submitting a ticket is less ideal than an application that we can push out with our monitoring service.

                  ..that sounds like it's got more features than making screenshots?

                  JD86 wrote:

                  Anyways I'm not going to worry about something to make sure the process is running at all times. I think it will be a rare occurrence when it isn't running anyways... so we can just deal with that when it comes.

                  Given the background, you do. I'd advise to try and "make it easy to submit" for a user; that's a bit broader focus, and could contain something like making your app easily restartable. My parents are using a shortcut to start their TeamViewer - it needn't be always on, as the shortcut is on the taskbar.

                  Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

                  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