I had a problem when the window style is none and the window is maximized that the window would cover the taskbar. I got a solution from here (I got the code from the source code not what he posted), and it works well except for one part. When you have two monitors and the primary monitor is smaller than your secondary monitor, then you maximize the window on your secondary monitor, this happens (notice the window is spilling out over the screen):
This is how it should look: (I just resized the window to full screen.)
It works here though:
What I'm doing is making a custom chrome thing. All the code and a sample project is uploaded here. Also if someone has any other ways to do this, I would really appreciate it. Thanks in advance!
EDIT Here is some of the code for quick refrence:
private static void WmGetMinMaxInfo(System.IntPtr hwnd, System.IntPtr lParam)
{
MINMAXINFO mmi = (MINMAXINFO)Marshal.PtrToStructure(lParam, typeof(MINMAXINFO));
// Adjust the maximized size and position to fit the work area of the correct monitor
int MONITOR_DEFAULTTONEAREST = 0x00000002;
System.IntPtr monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
if (monitor != System.IntPtr.Zero)
{
MONITORINFO monitorInfo = new MONITORINFO();
GetMonitorInfo(monitor, monitorInfo);
RECT rcWorkArea = monitorInfo.rcWork;
RECT rcMonitorArea = monitorInfo.rcMonitor;
mmi.ptMaxPosition.x = Math.Abs(rcWorkArea.left - rcMonitorArea.left);
mmi.ptMaxPosition.y = Math.Abs(rcWorkArea.top - rcMonitorArea.top) - 8;
mmi.ptMaxSize.x = Math.Abs(rcWorkArea.right - rcWorkArea.left);
mmi.ptMaxSize.y = Math.Abs(rcWorkArea.bottom - rcWorkArea.top) + 8;
if (rcWorkArea.bottom == rcMonitorArea.bottom)//full screen (no taskbar)
mmi.ptMaxSize.y--;//remove 1 px from the bottom for "Auto-hide taskbar" configuration
mmi.ptMinTrackSize.x = (int)currentlyChangingWindow.MinWidth;
mmi.ptMinTrackSize.y = (int)currentlyChangingWindow.MinHeight;
}
Marshal.StructureToPtr(mmi, lParam, true);
}
I didn't wright this code so I don't really know what is going on here. That's why I'm here.