Instead of creating something and then trying to hide it, simply don't create it in the first place
A customer had a question, which was sort of I bet somebody got a really nice bonus for that feature in reverse.
A customer is asking if there is a way to programmatically control the icons in the notification area.
Specifically, they want the setting for their notification icon to be “Only show notifications” rather than “Show icon and notifications” or “Hide icon and notifications.”
Icons Behaviors Power
Show icon and notifications ▾ Fully charged (100%) Network
Show icon and notifications ▾ Fabrikam Internet access Volume
Show icon and notifications ▾ Speakers: 10% Contoso Resource Notification
Only show notifications ▾ No new resources found.
It’s a good thing the customer explained what they wanted, because they started out asking for the impossible part. Arbitrary control of notification icons is not programmatically exposed because all the awesome programs would just force themselves on. But they clarified that what they really want is a way to reduce the visibility of their icon so it displays only when a notification is being shown. And there’s a way to do that, and it doesn’t involve having to programmatically configure anything. If you don’t want your notification icon to appear in the notification area, then don’t show your notification icon in the first place unless you have a notification.
- When your program starts, don’t call
Shell_NotifyIcon(NIM_ADD). Since you don’t call the function, you don’t get a notification icon.
- When you want to display a notification, call
- When the situation that calls for the notification has passed, call
In other words, use the notification icon in the manner it was intended.
It’s sad that notification icon abuse has become so popular (and application frameworks make it so easy to create an abusive notification icon) that people forget how to create a well-behaved notification icon. Instead, they start with the abusive method, and then try to figure out how to make it less abusive.