{"id":12573,"date":"2010-10-08T07:00:01","date_gmt":"2010-10-08T07:00:01","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2010\/10\/08\/why-does-taskdialog-return-immediately-without-showing-a-dialog-answer\/"},"modified":"2010-10-08T07:00:01","modified_gmt":"2010-10-08T07:00:01","slug":"why-does-taskdialog-return-immediately-without-showing-a-dialog-answer","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20101008-01\/?p=12573","title":{"rendered":"Why does TaskDialog return immediately without showing a dialog? &#8211; Answer"},"content":{"rendered":"<p><a href=\"http:\/\/blogs.msdn.com\/b\/oldnewthing\/archive\/2010\/10\/07\/10072517.aspx\"> Last time<\/a>, I left an exercise  to determine why the <code>Task&shy;Dialog<\/code> function was not actually displaying anything. The problem had nothing to do with an invalid window handle parameter and had all to do with original window being destroyed.\n My psychic powers told me that the window&#8217;s <code>WM_DESTROY<\/code> handler called <code>Post&shy;Quit&shy;Message<\/code>. As we learned some time ago, <a href=\"http:\/\/blogs.msdn.com\/b\/oldnewthing\/archive\/2005\/02\/22\/378018.aspx\"> quit messages cause modal loops to exit<\/a>. Since the code was calling <code>Task&shy;Dialog<\/code> after the window was destroyed, there was a <code>WM_QUIT<\/code> message still sitting in the queue, and that quit message caused the modal loop in <code>Task&shy;Dialog<\/code> to exit before it got a chance to display anything.\n <a href=\"http:\/\/blogs.msdn.com\/b\/oldnewthing\/archive\/2010\/10\/07\/10072517.aspx#10072956\"> Switching to <code>Message&shy;Box<\/code><\/a> wouldn&#8217;t have changed anything, since <code>Message&shy;Box<\/code> responds to quit messages the same way as <code>Task&shy;Dialog<\/code>.<\/p>\n<p> (<a href=\"http:\/\/blogs.msdn.com\/b\/oldnewthing\/archive\/2010\/10\/07\/10072517.aspx#10073115\">Worf<\/a> was the first person to post the correct answer.) <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last time, I left an exercise to determine why the Task&shy;Dialog function was not actually displaying anything. The problem had nothing to do with an invalid window handle parameter and had all to do with original window being destroyed. My psychic powers told me that the window&#8217;s WM_DESTROY handler called Post&shy;Quit&shy;Message. As we learned some [&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-12573","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>Last time, I left an exercise to determine why the Task&shy;Dialog function was not actually displaying anything. The problem had nothing to do with an invalid window handle parameter and had all to do with original window being destroyed. My psychic powers told me that the window&#8217;s WM_DESTROY handler called Post&shy;Quit&shy;Message. As we learned some [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/12573","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=12573"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/12573\/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=12573"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=12573"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=12573"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}