{"id":45611,"date":"2015-05-13T07:00:00","date_gmt":"2015-05-13T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/20150513-00\/?p=45611\/"},"modified":"2015-05-13T07:00:00","modified_gmt":"2015-05-13T07:00:00","slug":"why-dont-you-forward-wm_getminmaxinfo-and-clamp-the-results","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20150513-00\/?p=45611","title":{"rendered":"Why don&#039;t you forward WM_GETMINMAXINFO and clamp the results?"},"content":{"rendered":"<p>In my <a href=\"http:\/\/blogs.msdn.com\/b\/oldnewthing\/archive\/2015\/05\/04\/10611928.aspx\"> illustration of how to make a window resizable in only one direction<\/a>, commenter Josua asks, &#8220;<a href=\"http:\/\/blogs.msdn.com\/b\/oldnewthing\/archive\/2015\/05\/04\/10611928.aspx#10612099\">Why don&#8217;t you forward <code>WM_GET&shy;MIN&shy;MAX&shy;INFO<\/code> and clamp the results<\/a>?&#8221;\n I&#8217;m going to assume the question is really &#8220;Why don&#8217;t you forward <code>WM_GET&shy;MIN&shy;MAX&shy;INFO<\/code> before clamping the results?&#8221; rather than &#8220;Why did you bother writing all this code in the first place? Why not simply forward <code>WM_GET&shy;MIN&shy;MAX&shy;INFO<\/code> and clamp the results?&#8221;&sup1;\n The answer is that forwarding <code>WM_GET&shy;MIN&shy;MAX&shy;INFO<\/code> doesn&#8217;t do anything. As noted in the documentation, the incoming <code>MIN&shy;MAX&shy;INFO<\/code> structure already has the default values on entry. The default handler for the <code>WM_GET&shy;MIN&shy;MAX&shy;INFO<\/code> message returns without doing anything, since all the default handler does is accept the defaults.\n So sure, you could forward the message, and then clamp the results, but the forwarding doesn&#8217;t accomplish anything.<\/p>\n<p> &sup1; In case the question really was &#8220;Why did you bother writing all this code in the first place&#8230;&#8221;: Go ahead and delete all the changes aside from the initial version of the <code>On&shy;Get&shy;Min&shy;Max&shy;Info<\/code> handler. You&#8217;ll see the problems called out in the text: The resize arrows appear when the mouse hovers over the corners and the left and right edges. And if you maximize the window onto a secondary monitor, and that monitor&#8217;s height is different from the height of the primary monitor, it maximizes to the wrong height. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>In my illustration of how to make a window resizable in only one direction, commenter Josua asks, &#8220;Why don&#8217;t you forward WM_GET&shy;MIN&shy;MAX&shy;INFO and clamp the results?&#8221; I&#8217;m going to assume the question is really &#8220;Why don&#8217;t you forward WM_GET&shy;MIN&shy;MAX&shy;INFO before clamping the results?&#8221; rather than &#8220;Why did you bother writing all this code in the [&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-45611","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>In my illustration of how to make a window resizable in only one direction, commenter Josua asks, &#8220;Why don&#8217;t you forward WM_GET&shy;MIN&shy;MAX&shy;INFO and clamp the results?&#8221; I&#8217;m going to assume the question is really &#8220;Why don&#8217;t you forward WM_GET&shy;MIN&shy;MAX&shy;INFO before clamping the results?&#8221; rather than &#8220;Why did you bother writing all this code in the [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/45611","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=45611"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/45611\/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=45611"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=45611"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=45611"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}