{"id":7203,"date":"2012-07-05T07:00:00","date_gmt":"2012-07-05T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2012\/07\/05\/how-your-taskbar-auto-hide-settings-can-keep-getting-overwritten\/"},"modified":"2012-07-05T07:00:00","modified_gmt":"2012-07-05T07:00:00","slug":"how-your-taskbar-auto-hide-settings-can-keep-getting-overwritten","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20120705-00\/?p=7203","title":{"rendered":"How your taskbar auto-hide settings can keep getting overwritten"},"content":{"rendered":"<p>A customer reported that they were observing\nthat some users were finding their taskbar set to auto-hide even\nthough the standard configuration in the company is for the auto-hide\nfeature to be disabled.\nGoing into Taskbar Properties shows <i>Auto-hide the taskbar<\/i> checked.\nNone of the users had changed their setting to auto-hide manually,\nso the question was raised to the Windows team,\n&#8220;Are there any cases where Explorer will set the auto-hide setting\non its own?&#8221;\n<\/p>\n<p>\nExplorer does not set the auto-hide checkbox on its own.\nNow, the taskbar does auto-hide even when the setting is unchecked\nif it detects that the application is trying to go full-screen,\nsay, in order to show a slide show or\n<a HREF=\"http:\/\/blogs.msdn.com\/b\/oldnewthing\/archive\/2010\/10\/06\/10071954.aspx\">\nplay World of Warcraft<\/a>.\nBut that doesn&#8217;t check the check-box.\n<\/p>\n<p>\nFurther investigation revealed that\n<a HREF=\"http:\/\/blogs.msdn.com\/b\/oldnewthing\/archive\/2005\/05\/06\/415158.aspx\">\nthe check-box was being checked programmatically<\/a>\nby one of the programs that the company used.\nAnd it wasn&#8217;t custom software but a commercial product\nwhich targets the corporate market.\n<\/p>\n<p>\nThe customer reported back that the problem was sporadic.\nThey could not reproduce it consistently.\n<\/p>\n<p>\nMy guess is that the application in question was trying to\nenable auto-hide temporarily for whatever reason.\nAt program startup, it checks the current auto-hide setting,\nand if it&#8217;s off, it programmatically turns auto-hide on.\n<\/p>\n<pre>\npreviousState = IsAutoHideTaskbarEnabled();\nSetAutoHideTaskbar(true);\n<\/pre>\n<p>\nWhen the program exits, it restores the original setting.\n<\/p>\n<pre>\nSetAutoHideTaskbar(previousState);\n<\/pre>\n<p>\nThis is a highly fragile solution for several reasons:\nWhat if the application crashes before it can restore the setting?\n<\/p>\n<p><p>\nWhat if two people did this?\n<\/p>\n<ol>\n<li>Initially, auto-hide is off.\n<li>Program&nbsp;A remembers that auto-hide was off and sets it on.\n<li>Program&nbsp;B remembers that auto-hide was on and sets it on.\n<li>Program&nbsp;A exits and restores auto-hide to off.\n<\/ol>\n<p>\nOops, now we have a problem: Program&nbsp;B wants auto-hide on,\nbut Program&nbsp;A just turned it off.\n<\/p>\n<ol>\n<li VALUE=\"5\">Program&nbsp;B exits and restores auto-hide to on.\n<\/ol>\n<p>\nOops, the auto-hide setting was left in the &#8216;on&#8217; state\nafter everybody thought they had restored it.\n<\/p>\n<p>\nAs a special case of <i>What if two people did this?<\/i>,\nthe Program&nbsp;B could be the Taskbar Properties page itself.\nWhile your program is running, the user goes to Taskbar Properties\nand sees that the checkbox is set incorrectly.\nMaybe they go in and &#8220;fix it&#8221;, and now Program&nbsp;A is running\nwith a visible taskbar.<\/p>\n<p>\nWhat if the application tries to restore the state\nafter Explorer has already saved its settings?\nWhen the user logs off, all processes are told to clean up their toys\nand to go bed.\nIn response to <code>WM_ENDSESSION<\/code>,\nExplorer saves out its settings and calls it a night.\nWhat if this happens before the application programmatically unchecks\nthe box?\nExplorer says, &#8220;Okay, I unchecked the box.&#8221;\nBut Explorer already saved out its settings; these updated settings\naren&#8217;t going to be saved again.\n<\/p>\n<p>\nThis is what happens when you expose a global setting programmatically.\nPeople see the setting and think that twiddling it will solve their problem\ninstead of\n<a HRef=\"http:\/\/blogs.msdn.com\/b\/oldnewthing\/archive\/2008\/12\/11\/9193695.aspx\">\nlooking for a local solution to their local problem<\/a>,\nin this case\n<a HREF=\"http:\/\/blogs.msdn.com\/b\/oldnewthing\/archive\/2005\/05\/05\/414910.aspx\">\ncreating a fullscreen window that covers the taskbar<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A customer reported that they were observing that some users were finding their taskbar set to auto-hide even though the standard configuration in the company is for the auto-hide feature to be disabled. Going into Taskbar Properties shows Auto-hide the taskbar checked. None of the users had changed their setting to auto-hide manually, so the [&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-7203","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>A customer reported that they were observing that some users were finding their taskbar set to auto-hide even though the standard configuration in the company is for the auto-hide feature to be disabled. Going into Taskbar Properties shows Auto-hide the taskbar checked. None of the users had changed their setting to auto-hide manually, so the [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/7203","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=7203"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/7203\/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=7203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=7203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=7203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}