{"id":2973,"date":"2013-10-10T07:00:00","date_gmt":"2013-10-10T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2013\/10\/10\/how-do-i-find-out-what-size-the-window-manager-would-have-chosen-for-my-window\/"},"modified":"2013-10-10T07:00:00","modified_gmt":"2013-10-10T07:00:00","slug":"how-do-i-find-out-what-size-the-window-manager-would-have-chosen-for-my-window","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20131010-00\/?p=2973","title":{"rendered":"How do I find out what size the window manager would have chosen for my window?"},"content":{"rendered":"<p>We saw some time ago <a href=\"http:\/\/blogs.msdn.com\/b\/oldnewthing\/archive\/2012\/11\/26\/10371440.aspx\"> how the window manager decides where to place a newly-created window<\/a> if you pass the <code>CW_USE&shy;DEFAULT<\/code> values when creating the window. But what if you want to filter the values first? If you pass an explicit upper left corner but pass <code>CW_USE&shy;DEFAULT<\/code> for the width and height, then the bottom right corner will be down near the bottom right corner of the screen.<\/p>\n<blockquote class=\"q\"><p> Given that your <code>CW_USE&shy;DEFAULT<\/code> code is buggy, is there a way I can ask how big you would have made the window, so I can go in and fix your mistake? If I try to resize it after the fact, there&#8217;s an ugly flicker. I&#8217;m kind of disgusted that something this simple still doesn&#8217;t work after all these years. This is why Apple is eating your lunch. This code was obviously never tested because it doesn&#8217;t even work. <\/p><\/blockquote>\n<p> There appears to be some elevation of opinion to fact here, because the customer thinks that when you say &#8220;I will let you decide where to put the bottom right corner of the window&#8221;, and when the window manager decides to put the bottom right corner the window near the bottom right corner of the screen, then that is <i>obviously a bug<\/i>.\n Yeesh, if you don&#8217;t want to let the window manager choose the bottom right corner of the window, then don&#8217;t pass the value that says &#8220;I will let you choose the bottom right corner of the window.&#8221;\n Anyway, back to the original question.<\/p>\n<p> If you want to get a peek at the coordinates the window manager chose when you said, &#8220;You go ahead and choose,&#8221; you can just create the window without the <code>WS_VISIBLE<\/code> flag. And then look at the rectangle, and if you don&#8217;t like it, resize your window while it is still hidden. When you&#8217;re finally happy: Show it. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>We saw some time ago how the window manager decides where to place a newly-created window if you pass the CW_USE&shy;DEFAULT values when creating the window. But what if you want to filter the values first? If you pass an explicit upper left corner but pass CW_USE&shy;DEFAULT for the width and height, then the bottom [&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-2973","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>We saw some time ago how the window manager decides where to place a newly-created window if you pass the CW_USE&shy;DEFAULT values when creating the window. But what if you want to filter the values first? If you pass an explicit upper left corner but pass CW_USE&shy;DEFAULT for the width and height, then the bottom [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/2973","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=2973"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/2973\/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=2973"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=2973"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=2973"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}