{"id":7673,"date":"2012-05-09T07:00:00","date_gmt":"2012-05-09T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2012\/05\/09\/how-do-i-hide-a-window-without-blocking-on-it\/"},"modified":"2012-05-09T07:00:00","modified_gmt":"2012-05-09T07:00:00","slug":"how-do-i-hide-a-window-without-blocking-on-it","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20120509-00\/?p=7673","title":{"rendered":"How do I hide a window without blocking on it?"},"content":{"rendered":"<p>A customer was working on improving their application startup performance. They found that if their application was launched immediately after a fresh boot, the act of dismissing their splash screen was taking over 5% of their boot time. Their code removed the splash screen by calling <code>Show&shy;Window(hwndSplash, SW_HIDE)<\/code>. They suspect that the splash screen thread has, for some reason, stopped responding to messages, and while an investigation into that avenue was undertaken, a parallel investigation into reducing the cost of hiding the splash screen was also begun.\n One of the things they tried was to remove the <code>WS_EX_TOOL&shy;WINDOW<\/code> style and call <code>ITaskbarList::DeleteTab(hwndSplash)<\/code> but they found that it wasn&#8217;t helping.\n The reason it wasn&#8217;t helping is that <a href=\"http:\/\/blogs.msdn.com\/b\/oldnewthing\/archive\/2011\/02\/21\/10131989.aspx\"> editing the window style generates <code>WM_STYLE&shy;CHANGING<\/code>\/<code>WM_STYLE&shy;CHANGED<\/code> messages to the target window<\/a>, and now you&#8217;re back where you started.<\/p>\n<p> A better way is to use <code>Show&shy;Window&shy;Async(hwndSplash, SW_HIDE)<\/code>. The <code>-Async<\/code> version of the <code>Show&shy;Window<\/code> function is the <code>Send&shy;Notify&shy;Message<\/code> version of <code>Show&shy;Window<\/code>: If the window belongs to another thread group, then it schedules the operation but does not wait for it to complete. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>A customer was working on improving their application startup performance. They found that if their application was launched immediately after a fresh boot, the act of dismissing their splash screen was taking over 5% of their boot time. Their code removed the splash screen by calling Show&shy;Window(hwndSplash, SW_HIDE). They suspect that the splash screen thread [&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-7673","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>A customer was working on improving their application startup performance. They found that if their application was launched immediately after a fresh boot, the act of dismissing their splash screen was taking over 5% of their boot time. Their code removed the splash screen by calling Show&shy;Window(hwndSplash, SW_HIDE). They suspect that the splash screen thread [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/7673","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=7673"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/7673\/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=7673"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=7673"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=7673"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}