{"id":36343,"date":"2005-02-28T07:00:00","date_gmt":"2005-02-28T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2005\/02\/28\/modality-part-6-interacting-with-a-program-that-has-gone-modal\/"},"modified":"2005-02-28T07:00:00","modified_gmt":"2005-02-28T07:00:00","slug":"modality-part-6-interacting-with-a-program-that-has-gone-modal","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20050228-00\/?p=36343","title":{"rendered":"Modality, part 6: Interacting with a program that has gone modal"},"content":{"rendered":"<p> <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2005\/02\/24\/379635.aspx\"> Earlier we saw the importance of setting the right owner window for modal UI<\/a>. It is also important, when manipulating a window, to respect its modality.  For example, consider the program we ended up with last time, the one which calls the <code>MessageBox<\/code> function to display a modal dialog. If we wanted to get that program to exit and sent a <code>WM_CLOSE<\/code> message to the main window instead of its modal popup, the main window would likely exit and leave the message box stranded, resulting in <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2005\/02\/23\/378866.aspx\"> the same stack trace without support we saw in part&nbsp;4<\/a>. <\/p>\n<p> Respect the modality of a window. If it is disabled, don&#8217;t try to get it to do things; it&#8217;s disabled because it doesn&#8217;t want to do anything right now. You can <a href=\"http:\/\/msdn.microsoft.com\/library\/en-us\/winui\/WinUI\/WindowsUserInterface\/Windowing\/Windows\/WindowReference\/WindowFunctions\/GetLastActivePopup.asp\"> go hunting for its modal pop-up<\/a> and talk to that pop-up. (Unless, of course, that pop-up is itself disabled, in which case you get to keep on hunting.) <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Earlier we saw the importance of setting the right owner window for modal UI. It is also important, when manipulating a window, to respect its modality. For example, consider the program we ended up with last time, the one which calls the MessageBox function to display a modal dialog. If we wanted to get that [&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,143],"class_list":["post-36343","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code","tag-modality"],"acf":[],"blog_post_summary":"<p>Earlier we saw the importance of setting the right owner window for modal UI. It is also important, when manipulating a window, to respect its modality. For example, consider the program we ended up with last time, the one which calls the MessageBox function to display a modal dialog. If we wanted to get that [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/36343","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=36343"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/36343\/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=36343"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=36343"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=36343"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}