{"id":112167,"date":"2026-03-26T07:00:00","date_gmt":"2026-03-26T14:00:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/oldnewthing\/?p=112167"},"modified":"2026-03-26T08:50:49","modified_gmt":"2026-03-26T15:50:49","slug":"20260326-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20260326-00\/?p=112167","title":{"rendered":"Why doesn&#8217;t <CODE>WM_<WBR>ENTER&shy;IDLE<\/CODE> work if the dialog box is a <CODE>Message&shy;Box<\/CODE>?"},"content":{"rendered":"<p>Last time, <a title=\"How can I change a dialog box's message loop to do a Msg\u00adWait\u00adFor\u00adMultiple\u00adObjects instead of Get\u00adMessage?\" href=\"https:\/\/devblogs.microsoft.com\/oldnewthing\/20260325-00\/?p=112165\"> we looked at how the owner of a dialog can take control just before the dialog box message loop goes idle. I said that I pulled a trick. <\/a><\/p>\n<p>The trick is that I used the common file open dialog instead of a simple <code>Message\u00adBox<\/code>. Indeed, if you replace the call to <code>Get\u00adOpen\u00adFile\u00adName<\/code> with a call to <code>Message\u00adBox<\/code>, then no <code>WM_<wbr \/>ENTER\u00adIDLE<\/code> message arrives, and you get no beeping. What&#8217;s going on?<\/p>\n<p>A dialog can suppress the <code>WM_<wbr \/>ENTER\u00adIDLE<\/code> message by adding the <code>DS_<wbr \/>NO\u00adIDLE\u00adMSG<\/code> dialog style to its template. And that&#8217;s what the template used by the <code>Message\u00adBox<\/code> function does.<\/p>\n<p>So the <code>WM_<wbr \/>ENTER\u00adIDLE<\/code> trick does require a small amount of cooperation from the dialog box, namely that it doesn&#8217;t disable <code>WM_<wbr \/>ENTER\u00adIDLE<\/code> messages.<\/p>\n<p>But say you can guarantee the cooperation of the dialog box because you <i>are<\/i> the dialog box. Right now, the <code>WM_<wbr \/>ENTER\u00adIDLE<\/code> message allows a dialog <i>owner<\/i> to be notified when the dialog message loop is about to go idle. But what if the dialog box itself wants to know, so it can customize its own message loop?<\/p>\n<p>We&#8217;ll look at that next time.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Because it opted out.<\/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-112167","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>Because it opted out.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/112167","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=112167"}],"version-history":[{"count":1,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/112167\/revisions"}],"predecessor-version":[{"id":112168,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/112167\/revisions\/112168"}],"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=112167"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=112167"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=112167"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}