コード例 #1
0
        private void WmGetMinMaxInfo(IntPtr hwnd, IntPtr lParam)
        {
            WindowWndProcHandler.MINMAXINFO structure = (WindowWndProcHandler.MINMAXINFO)Marshal.PtrToStructure(lParam, typeof(WindowWndProcHandler.MINMAXINFO));
            IntPtr hmonitor = NativeMethods.MonitorFromWindow(hwnd, 1);

            if (hmonitor != IntPtr.Zero)
            {
                WindowWndProcHandler.MONITORINFOEX info = new WindowWndProcHandler.MONITORINFOEX()
                {
                    cbSize = Marshal.SizeOf(typeof(MONITORINFO))
                };
                NativeMethods.GetMonitorInfo(hmonitor, info);
                IntereopRect rcWork    = info.rcWork;
                IntereopRect rcMonitor = info.rcMonitor;
                WindowWndProcHandler.TaskbarLocation taskbarPosition = WindowWndProcHandler.GetTaskbarPosition();
                if (!this.mWindowInstance.mIsFullScreen)
                {
                    structure.ptMaxPosition.X = Math.Abs(rcWork.Left - rcMonitor.Left);
                    structure.ptMaxPosition.Y = Math.Abs(rcWork.Top - rcMonitor.Top);
                    structure.ptMaxSize.X     = Math.Abs(rcWork.Width);
                    structure.ptMaxSize.Y     = Math.Abs(rcWork.Height);
                    if (rcWork == rcMonitor)
                    {
                        switch (taskbarPosition)
                        {
                        case WindowWndProcHandler.TaskbarLocation.Left:
                            structure.ptMaxPosition.X += 2;
                            break;

                        case WindowWndProcHandler.TaskbarLocation.Top:
                            structure.ptMaxPosition.Y += 2;
                            break;

                        case WindowWndProcHandler.TaskbarLocation.Right:
                            structure.ptMaxSize.X -= 2;
                            break;

                        case WindowWndProcHandler.TaskbarLocation.Bottom:
                            structure.ptMaxSize.Y -= 2;
                            break;
                        }
                    }
                }
                else
                {
                    structure.ptMaxPosition.X = 0;
                    structure.ptMaxPosition.Y = 0;
                    structure.ptMaxSize.X     = Math.Abs(rcMonitor.Width);
                    structure.ptMaxSize.Y     = Math.Abs(rcMonitor.Height);
                }
                structure.ptMaxTrackSize.X = structure.ptMaxSize.X;
                structure.ptMaxTrackSize.Y = structure.ptMaxSize.Y;
            }
            Marshal.StructureToPtr((object)structure, lParam, true);
        }
コード例 #2
0
        internal static IntereopRect GetFullscreenMonitorSize(
            IntPtr hwnd,
            bool isWorkAreaRequired = false)
        {
            IntPtr hmonitor = NativeMethods.MonitorFromWindow(hwnd, 1);

            if (!(hmonitor != IntPtr.Zero))
            {
                return(new IntereopRect());
            }
            WindowWndProcHandler.MONITORINFOEX info = new WindowWndProcHandler.MONITORINFOEX();
            NativeMethods.GetMonitorInfo(hmonitor, info);
            return(isWorkAreaRequired ? info.rcWork : info.rcMonitor);
        }
コード例 #3
0
 internal static extern bool GetMonitorInfo(
     IntPtr hmonitor,
     [In, Out] WindowWndProcHandler.MONITORINFOEX info);