{"id":40303,"date":"2004-03-11T07:00:00","date_gmt":"2004-03-11T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2004\/03\/11\/why-are-dialog-boxes-initially-created-hidden\/"},"modified":"2004-03-11T07:00:00","modified_gmt":"2004-03-11T07:00:00","slug":"why-are-dialog-boxes-initially-created-hidden","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20040311-00\/?p=40303","title":{"rendered":"Why are dialog boxes initially created hidden?"},"content":{"rendered":"<p>You may not have noticed it until you looked closely,  but dialog boxes are actually created hidden initially,  even if you specify WS_VISIBLE in the template.  The reason for this is historical.\n  Rewind back to the old days (we&#8217;re talking Windows 1.0),  graphics cards are slow and  CPUs are slow and memory is slow. You can  pick a menu option that displays a dialog and  wait a second or two for the dialog to get loaded  off the floppy disk. (Hard drives are for the rich  kids.) And then you have to wait for the dialog box  to paint.\n  To save valuable seconds, dialog boxes are created  initially hidden and all typeahead is processed while  the dialog stays hidden.  Only after the typeahead  is finished is the dialog box finally shown.  And if you typed far ahead enough and hit Enter,  you might even have been able to finish the entire dialog  box without it ever being shown!  Now that&#8217;s efficiency.\n  Of course, nowadays, programs are stored on hard drives  and you can&#8217;t (normally) out-type a hard drive, so this optimization  is largely wasted, but the behavior remains for compatibility  reasons.<\/p>\n<p>  Actually this behavior still serves a useful purpose:  If the dialog were initially created visible, then the  user would be able to see all the controls being created  into it, and watch as WM_INITDIALOG ran (changing default  values, hiding and showing controls, moving  controls around&#8230;)  This is both ugly and distracting.  (&#8220;How come the box comes up checked, then suddenly unchecks  itself before I can click on it?&#8221;)  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>You may not have noticed it until you looked closely, but dialog boxes are actually created hidden initially, even if you specify WS_VISIBLE in the template. The reason for this is historical. Rewind back to the old days (we&#8217;re talking Windows 1.0), graphics cards are slow and CPUs are slow and memory is slow. You [&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":[2],"class_list":["post-40303","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-history"],"acf":[],"blog_post_summary":"<p>You may not have noticed it until you looked closely, but dialog boxes are actually created hidden initially, even if you specify WS_VISIBLE in the template. The reason for this is historical. Rewind back to the old days (we&#8217;re talking Windows 1.0), graphics cards are slow and CPUs are slow and memory is slow. You [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/40303","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=40303"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/40303\/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=40303"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=40303"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=40303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}