views:

1479

answers:

5

This is a pretty stupid question, but here goes:

Is there a way (in .net) to force Windows to show your system tray icon instead of hiding it? I don't want to do this all the time, but at least for the first time my application is run I would like it to be visible in the system tray.

+7  A: 

Are you taking about Windows 7? If so, then no.

JP Alioto
And thank god for that
jalf
Thanks for the link. That's what I needed to know.
Andrew
+4  A: 

As Raymond Chen would say, "Imagine if this were possible." Now tell me how many apps would choose not to force their tray icon to be always visible! Everybody thinks their tray icon is the most important. If there was a programmatic way to say "show my tray icon all the time", we'd be back to Windows 95.

Configuration of tray-icon hiding is left to the user, on purpose. If you want to always see your tray icon on your computer, there's nothing stopping you. Just right-click on the expander button, click "Customize Notification Icons" (that's what it's called in Vista, may vary in other OS versions), find your app's tray icon in the list, and select "Show".

Joe White
+2  A: 

The first time your tray icon is shown, it will be made visible, at least for a short time. The rest is left up to the user - if they want to hide it then you should really respect that decision.

1800 INFORMATION
I have every intention of respecting the user's intentions. Thanks.
Andrew
@Andrew: then there is nothing to do, it'll show on the first use
TM
Unfortunately, that has not been the case in my testing. Maybe it's an anomaly, but I believe Windows is hiding my icon right off the bat. This will be confusing to some users. Just wanted to see if there was a way to go "Look at me. I'm down here!" right after installation.
Andrew
+2  A: 

There is no way to force it to be visible (as noted above, and rightly so), however if you show a balloon notification (like Windows Live Messenger does when you first try to close the window), your icon will appear while the balloon is visible. You could also use this to draw attention to your app to say "look at me, I'm down here!".

Please, for the sake of your users, make it only do this once, at most, though!

Jon Grant
Thanks for the advice. I may or may not try this approach. Even used once, I think the idea would be annoying to the user. Whatever I do, I promise to code responsibly. I hate programs that think they know what's best for me, too ;-)
Andrew
+3  A: 

it does not show because, even if you uninstall your application, the display setting is saved under the PastIconsStream registry entry. Windows saves the settings for icon identifiers even if the app isn't already installed. For the first install, it will appear, then hide itself (which is what you want to achieve, I think). For subsequent installs, it won't appear anymore, because Windows remembers the setting. If you are still testing your application, try clearing the PastIconsStream registry entry. This will revert back to the "show at first, then hide" behavior.

maranas
Ahhh... that explains what I was experiencing before. I thought maybe there was something different with my installation a while ago because I have noticed the "show at first, then hide" on other machines since then. Thanks.
Andrew