Date: | May 1, 2015 / year-entry #91 |
Tags: | code |
Orig Link: | https://blogs.msdn.microsoft.com/oldnewthing/20150501-00/?p=44964 |
Comments: | 2 |
Summary: | There is a note down in the documentation for the MINMAXINFO structure: For systems with multiple monitors, the ptMaxSize and ptMaxPosition members describe the maximized size and position of the window on the primary monitor, even if the window ultimately maximizes onto a secondary monitor. In that case, the window manager adjusts these values to... |
There is a note down in the documentation for the
People ask about the nature of this "compensation" and how they should deal with it. When the window manager sends the
Two of these values are monitor-relative and are therefore subject to adjustment. ptMaxPosition is easy. The point is moved to a corresponding relative position on the window's actual monitor. ptMaxSize is trickier. If the specified size is greater than or equal to the size of the primary monitor, then the ptMaxSize is adjusted to include the difference in size between the primary monitor and the actual monitor. In other words, if ptMaxSize is 20 pixels larger than the primary monitor, then it will be adjusted to being 20 pixels larger than the actual monitor. But if ptMaxSize does not completely cover the monitor, then its value is used as-is. That is what the documentation is referring to when it says "In that case." The case is "if the window ultimately maximizes onto a secondary monitor." There is a bit of a gotcha here: If your window is larger than the screen in one direction but not another. For example, you may have a narrow maximum width but a tall maximum height. (Think console windows.) In that case, you will need to use We'll dig a little deeper into this gotcha next time. |
Comments (2)
Comments are closed. |
I presume the linked page will be updated to include this important, but non-obvious, information. :-)
What I used to hate about WM_GETMINMAXINFO is that it was sent very early on in the window creation process when I didn't actually know much about my window, let alone how small or big I was prepared to let it be.
And of course the other problem is that the region of allowable dimensions is nonrectangular, for example the maximum height or width might be 256 but only one dimension can exceed 240 at a time, except for the square of size 241.
Fortunately you can handle all that in other ways these days.