I have a WPF application that processes WM_GETMINMAXINFO to configure chrome windows and still respect the system taskbar. That is, when you enlarge the window on the monitor using the taskbar on it, it will not close the taskbar. This works fine, except that the window frame is still visible at maximum magnification, which is both ugly and useless, because the window cannot be resized when it is maximized anyway.
To handle this, I decided that I needed to change the processing of WM_GETMINMAXINFO to increase the window size as follows:
var monitorInfo = new SafeNativeMethods.MONITORINFO { cbSize = Marshal.SizeOf(typeof(SafeNativeMethods.MONITORINFO)) }; SafeNativeMethods.GetMonitorInfo(monitor, ref monitorInfo); var workArea = monitorInfo.rcWork; var monitorArea = monitorInfo.rcMonitor; minMaxInfo.ptMaxPosition.x = Math.Abs(workArea.left - monitorArea.left); minMaxInfo.ptMaxPosition.y = Math.Abs(workArea.top - monitorArea.top); minMaxInfo.ptMaxSize.x = Math.Abs(workArea.right - workArea.left); minMaxInfo.ptMaxSize.y = Math.Abs(workArea.bottom - workArea.top);
It really works, but my concern is the last four lines, where I assume the frame width is 2 pixels. Is there a more general approach to getting the frame width, so can I put it in my WM_GETMINMAXINFO handler?
thanks
source share