AGS.Editor.Components.HelpCommandsComponent.AdjustHelpWindowSize C# (CSharp) Method

AdjustHelpWindowSize() private method

The HTML Help API's HtmlHelp method forces the help window to stretch across multiple monitors if it opens at a negative location (-x, -y). This method resizes the window to the work-space size of the monitor that it is in. This method must be called immediately after opening the Help window with the Help class.
private AdjustHelpWindowSize ( ) : bool
return bool
        private bool AdjustHelpWindowSize()
        {
            IntPtr helpHandle = Process.GetCurrentProcess().MainWindowHandle; // get the Help window handle
            if (helpHandle == null)
            {
                return false;
            }
            MonitorInfo monitorInfo = new MonitorInfo();
            monitorInfo.cbSize = Marshal.SizeOf(monitorInfo);
            if (!GetMonitorInfo(MonitorFromWindow(helpHandle, MONITOR_DEFAULTTONEAREST), ref monitorInfo))
            {
                return false;
            }
            Rect workSize = monitorInfo.rcWork;
            return SetWindowPos(helpHandle, IntPtr.Zero, workSize.Left, workSize.Top, workSize.Right - workSize.Left, workSize.Bottom - workSize.Top, SWP_NOZORDER);
        }