Cannot see system tray icon
-
Hi! I have a created a windows service. Now I'm writing an application that monitors this service. I want the application to display a NotifyIcon in the system tray. Also I want the service to start the monitoring application if it's not already running. If I start the application on it's own everything works fine. I can see and intercat with my icon, but if the service starts the application I can see the process running in the Task Manager but the system tray icon is missing. Any ideas?
-
Hi! I have a created a windows service. Now I'm writing an application that monitors this service. I want the application to display a NotifyIcon in the system tray. Also I want the service to start the monitoring application if it's not already running. If I start the application on it's own everything works fine. I can see and intercat with my icon, but if the service starts the application I can see the process running in the Task Manager but the system tray icon is missing. Any ideas?
It's missing because the service started the monitoring application on the wrong desktop. Service run under their own desktop, not the one you see when you log in. You might want to try going into the Service manager, getting properties on your service, click the LogOn tab, and check the box that says something like "Allow service to interact with desktop". RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
It's missing because the service started the monitoring application on the wrong desktop. Service run under their own desktop, not the one you see when you log in. You might want to try going into the Service manager, getting properties on your service, click the LogOn tab, and check the box that says something like "Allow service to interact with desktop". RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
Yes, I guessed that it was something like that. When the service is starting the monitoring application they both run as SYSTEM in the task manager. I've tried to set it to allow interaction with my desktop, as you proposed, with no result. I also tried to allow the service to run as my user account. Now both the service and the monitoring application is running as my local user in the task manager but still no system tray icon?
-
Yes, I guessed that it was something like that. When the service is starting the monitoring application they both run as SYSTEM in the task manager. I've tried to set it to allow interaction with my desktop, as you proposed, with no result. I also tried to allow the service to run as my user account. Now both the service and the monitoring application is running as my local user in the task manager but still no system tray icon?
I was afraid of that... The easier method is to not create the monitor process from the service. This is because the service will run without a user being logged in, and hence, there's no desktop to start the process on anyway. You can use .NET Remoting to get status information from your service. Start the manager application out of the Run key in the Registry. This will start the monitor whenever a user logs in. This monitor can then contact the service over Remoting and get status information and updates through events over Remoting. Then the monitor can put up the icon in the Tray without any desktop problems. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome