views:

52

answers:

2

I need to know if the user has hidden an icon added by my program to the system tray area. Is it technically feasible?

UPDATE My program - yowindow displays the current temperature in the system-tray icon. I want to spare the server load by not auto-updating the weather for the users who don't see the tray-icon.

+2  A: 

No.

And what would you do with this information, even if you had it?

(caveat - I guess you could do a screen-grab, work out where the taskbar is, figure out where the system tray is, "parse" out each icon, then bitmap compare each against your own icon. But really...)

It might be worth your while looking at this related question

Based on first Edit to question

I can see your point. But look at it from the windows API designer's POV. They provided a facility for icons to be created in an "always visible" manner. And every man+dog went ahead and put an icon in there, on the presumption that the user would always want to know about their product (please note, I'm not claiming that you're in this group here).

They've noticed this runaway behavior, and whilst they can't now take away the ability to create these icons, they want to give the user control.

Now we come to the problem. Imagine, for a second, that you're a less than enlightened developer. And if you detect that your icon has been hidden, you pop up a message prompting the user to un-hide your icon. Maybe you do this once per login. Maybe you do it every half an hour. It's just a general level of user annoyance, similar to having 40 icons appear in the tray, when the user doesn't care about most of them

The question is - if you were designing an API to allow developers to discover whether their icon is, in fact, hidden. How do you allow your benign usage, whilst preventing the behavior in the previous paragraph? Spend a few minutes trying to pretend to be a windows API designer, and try to write the necessary function(s) (for the sake of argument, assume the annoying developers aren't willing to implement the IAmEvil interface, or whatever, or would be willing to implement the IOnlyDoGood interface...)

Hopefully, your icon is useful, and users will either a) show your icon, or b) remove your application (if it's not doing what they want/need)

Damien_The_Unbeliever
See my update to the question
Pavel
Very well explained.I agree with you, as soon as Windows give developes the control over the icon visibility, they would start to beg the user to display the icon back. Thank you Damien! Mark your reply as the answer.
Pavel
+1  A: 

There is no API function for that as far as I know, and there's no good solution to the problem. You could directly after the installation show a message from the tray telling the user that the icon may be hidden. Not that it will help, but it's all you can do. I've seen programs that bug the user by periodically showing that message but this is really NOT a good thing to do.

cobian