{"id":12053,"date":"2010-12-10T07:00:00","date_gmt":"2010-12-10T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2010\/12\/10\/how-do-i-limit-the-size-of-the-preview-window-used-by-aero-snap\/"},"modified":"2010-12-10T07:00:00","modified_gmt":"2010-12-10T07:00:00","slug":"how-do-i-limit-the-size-of-the-preview-window-used-by-aero-snap","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20101210-00\/?p=12053","title":{"rendered":"How do I limit the size of the preview window used by Aero Snap?"},"content":{"rendered":"<p>\nA customer reported that the translucent preview shows by\n<a HREF=\"http:\/\/blogs.msdn.com\/e7\/archive\/2009\/03\/17\/designing-aero-snap.aspx\">\nAero Snap<\/a>\nshowed the wrong dimensions for their application window.\n&#8220;As you can see in the screen shot, the preview is too wide.\nOur application window has a maximum width,\nbut the preview is fully half the width of the screen.\nHow can we disable the Aero Snap feature?&#8221;\n<\/p>\n<p>\nWhoa there,\ngiving up so easily?\nSounds like you&#8217;re throwing the baby out with the bathwater.\n<\/p>\n<p>\nTo control the size of the preview window used by Aero Snap,\nyou respond to the same message you&#8217;ve already been responding\nto in order to tell Windows the valid range of sizes for your\nwindow:\n<code>WM_GET&shy;MIN&shy;MAX&shy;INFO<\/code>.\n<\/p>\n<p>\nStart with our\n<a HREF=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2003\/07\/23\/54576.aspx\">\nscratch program<\/a>\nand make the following changes:\n<\/p>\n<pre>\nvoid OnGetMinMaxInfo(HWND hwnd, LPMINMAXINFO pmmi)\n{\n  pmmi-&gt;ptMaxTrackSize.x = 400;\n}\n\/\/ add to WndProc\n    HANDLE_MSG(hwnd, WM_GETMINMAXINFO, OnGetMinMaxInfo);\n<\/pre>\n<p>\nWe specify in the <code>On&shy;Get&shy;Min&shy;Max&shy;Info<\/code>\nfunction that\nthe maximum width for the window is 400&nbsp;pixels.\n(In real life, of course, you wouldn&#8217;t hard-code the width,\nbut this is just a proof of concept program.)\nSince we don&#8217;t touch <code>ptMaxTrackSize.y<\/code>,\nwe impose no additional constraints on the window height\nbeyond what comes with Windows by default.\n<\/p>\n<p>\nRun this program, and use Aero Snap to shove it against the\nedges of the screen.\nObserve that the Aero Snap preview respects our maximum\nwindow width.\n<\/p>\n<p>\nI never heard back from the customer, so I assume this simple\nsolution worked for them.\nThe fact that they had to ask this question tells me that\nthey hadn&#8217;t been handling the <code>WM_GET&shy;MIN&shy;MAX&shy;INFO<\/code>\nmessage\nat all;\ninstead, they were enforcing their window size procedurally\nafter the window manager already decided on the wrong size.\nEither they didn&#8217;t seem to mind that the maximize and restore\nanimations showed the window animating to the wrong size,\nor they couldn&#8217;t figure out how to fix that problem either.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A customer reported that the translucent preview shows by Aero Snap showed the wrong dimensions for their application window. &#8220;As you can see in the screen shot, the preview is too wide. Our application window has a maximum width, but the preview is fully half the width of the screen. How can we disable 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-12053","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>A customer reported that the translucent preview shows by Aero Snap showed the wrong dimensions for their application window. &#8220;As you can see in the screen shot, the preview is too wide. Our application window has a maximum width, but the preview is fully half the width of the screen. How can we disable the [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/12053","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=12053"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/12053\/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=12053"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=12053"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=12053"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}