{"id":8253,"date":"2012-02-22T07:00:00","date_gmt":"2012-02-22T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2012\/02\/22\/instead-of-creating-something-and-then-trying-to-hide-it-simply-dont-create-it-in-the-first-place\/"},"modified":"2012-02-22T07:00:00","modified_gmt":"2012-02-22T07:00:00","slug":"instead-of-creating-something-and-then-trying-to-hide-it-simply-dont-create-it-in-the-first-place","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20120222-00\/?p=8253","title":{"rendered":"Instead of creating something and then trying to hide it, simply don&#039;t create it in the first place"},"content":{"rendered":"<p>A customer had a question, which was sort of <a href=\"http:\/\/blogs.msdn.com\/b\/oldnewthing\/archive\/2006\/11\/01\/922449.aspx\"> <i>I bet somebody got a really nice bonus for that feature<\/i><\/a> in reverse.<\/p>\n<blockquote class=\"q\"><p>  A customer is asking if there is a way to programmatically control the icons in the notification area. <\/p>\n<p> Specifically, they want the setting for their notification icon to be &#8220;Only show notifications&#8221; rather than &#8220;Show icon and notifications&#8221; or &#8220;Hide icon and notifications.&#8221; <\/p>\n<table border=\"0\" cellpadding=\"3\" style=\"border-collapse: collapse\">\n<tr>\n<td style=\"border-bottom: solid .75pt black\"><b>Icons<\/b><\/td>\n<td colspan=\"2\" style=\"border-bottom: solid .75pt black\"><b>Behaviors<\/b><\/td>\n<\/tr>\n<tr>\n<td>Power<\/td>\n<td rowspan=\"2\">\n<table cellpadding=\"0\" style=\"width: 100%;border: solid .75pt black\">\n<tr>\n<td>Show icon and notifications<\/td>\n<td>&#9662;<\/td>\n<\/tr>\n<\/table>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"color: gray\"><i>Fully charged (100%)<\/i><\/td>\n<\/tr>\n<tr>\n<td>Network<\/td>\n<td rowspan=\"2\">\n<table cellpadding=\"0\" style=\"width: 100%;border: solid .75pt black\">\n<tr>\n<td>Show icon and notifications<\/td>\n<td>&#9662;<\/td>\n<\/tr>\n<\/table>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"color: gray\"><i>Fabrikam Internet access<\/i><\/td>\n<\/tr>\n<tr>\n<td>Volume<\/td>\n<td rowspan=\"2\">\n<table cellpadding=\"0\" style=\"width: 100%;border: solid .75pt black\">\n<tr>\n<td>Show icon and notifications<\/td>\n<td>&#9662;<\/td>\n<\/tr>\n<\/table>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"color: gray\"><i>Speakers: 10%<\/i><\/td>\n<\/tr>\n<tr style=\"background: yellow\">\n<td>Contoso Resource Notification<\/td>\n<td rowspan=\"2\">\n<table cellpadding=\"0\" style=\"width: 100%;border: solid .75pt black\">\n<tr>\n<td>Only show notifications<\/td>\n<td>&#9662;<\/td>\n<\/tr>\n<\/table>\n<\/td>\n<\/tr>\n<tr style=\"background: yellow\">\n<td style=\"color: gray\"><i>No new resources found.<\/i><\/td>\n<\/tr>\n<\/table>\n<\/blockquote>\n<p> It&#8217;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.\n And there&#8217;s a way to do that, and it doesn&#8217;t involve having to programmatically configure anything.\n If you don&#8217;t want your notification icon to appear in the notification area, then <i>don&#8217;t show your notification icon in the first place<\/i> unless you have a notification.<\/p>\n<ul>\n<li>When your program starts, don&#8217;t call     <code>Shell_Notify&shy;Icon(NIM_ADD)<\/code>.     Since you don&#8217;t call the function, you don&#8217;t get a notification icon. <\/li>\n<li>When you want to display a notification,     call     <code>Shell_Notify&shy;Icon(NIM_ADD)<\/code>. <\/li>\n<li>When the situation that calls for the notification has passed,     call     <code>Shell_Notify&shy;Icon(NIM_REMOVE)<\/code>. <\/li>\n<\/ul>\n<p> In other words, use the notification icon in the manner it was intended.<\/p>\n<p> It&#8217;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. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &#8220;Only show notifications&#8221; rather [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-8253","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>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 &#8220;Only show notifications&#8221; rather [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/8253","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=8253"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/8253\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=8253"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=8253"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=8253"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}