{"id":6423,"date":"2012-10-03T07:00:00","date_gmt":"2012-10-03T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2012\/10\/03\/how-do-i-suppress-the-default-animation-that-occurs-when-i-hide-or-show-a-window\/"},"modified":"2012-10-03T07:00:00","modified_gmt":"2012-10-03T07:00:00","slug":"how-do-i-suppress-the-default-animation-that-occurs-when-i-hide-or-show-a-window","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20121003-00\/?p=6423","title":{"rendered":"How do I suppress the default animation that occurs when I hide or show a window?"},"content":{"rendered":"<p>\nA customer wanted to know how they can disable\nthe default fade-in\/fade-out\nanimation that occurs when a window is hidden or shown.\n&#8220;I don&#8217;t want to use\n<code>WS_EX_TOOL&shy;WINDOW<\/code> because that\ncauses my window to disappear from the taskbar.\nI tried\n<code>Dwm&shy;Enable&shy;Composition<\/code> but that\naffects the entire desktop and is too jarring.\nWe want to suppress the effect because our program\nreplaces one window with another, and we want the operation\nto be invisible to the user.&#8221;\n<\/p>\n<p>\nWhoa, heading straight for\n<code>Dwm&shy;Enable&shy;Composition<\/code>?\nThat&#8217;s using a global solution to a local problem.\n<\/p>\n<p>\nTo disable the animations on a specific window,\nuse something like this:\n<\/p>\n<pre>\nHRESULT DisableDwmAnimations(HWND hwnd)\n{\n    BOOL fDisable = TRUE;\n    return DwmSetWindowAttribute(hwnd,\n                DWMWA_TRANSITIONS_FORCEDISABLED,\n                &amp;fDisable,\n                sizeof(fDisable));\n}\n<\/pre>\n<p>\nRe-enabling the animations is left as an exercise for the reader.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A customer wanted to know how they can disable the default fade-in\/fade-out animation that occurs when a window is hidden or shown. &#8220;I don&#8217;t want to use WS_EX_TOOL&shy;WINDOW because that causes my window to disappear from the taskbar. I tried Dwm&shy;Enable&shy;Composition but that affects the entire desktop and is too jarring. We want to suppress [&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-6423","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>A customer wanted to know how they can disable the default fade-in\/fade-out animation that occurs when a window is hidden or shown. &#8220;I don&#8217;t want to use WS_EX_TOOL&shy;WINDOW because that causes my window to disappear from the taskbar. I tried Dwm&shy;Enable&shy;Composition but that affects the entire desktop and is too jarring. We want to suppress [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/6423","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=6423"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/6423\/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=6423"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=6423"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=6423"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}