コード例 #1
0
ファイル: Win32.cs プロジェクト: maxschmeling/flamecage
 internal static extern bool GetMonitorInfo(IntPtr hMonitor, MONITORINFO lpmi);
コード例 #2
0
    public void WmGetMinMaxInfo(IntPtr hwnd, IntPtr lParam)
    {
      var structure = (MINMAXINFO) Marshal.PtrToStructure(lParam, typeof (MINMAXINFO));
      var hMonitor = Win32.MonitorFromWindow(hwnd, 2);
      if (hMonitor != IntPtr.Zero)
      {
        var monitorinfo = new MONITORINFO();
        Win32.GetMonitorInfo(hMonitor, monitorinfo);

        var rcWork = monitorinfo.rcWork;
        var rcMonitor = monitorinfo.rcMonitor;

        structure.ptMaxPosition.x = Math.Abs(rcWork.left - rcMonitor.left);
        structure.ptMaxPosition.y = Math.Abs(rcWork.top - rcMonitor.top);
        structure.ptMaxSize.x = Math.Abs(rcWork.right - rcWork.left);
        structure.ptMaxSize.y = Math.Abs(rcWork.bottom - rcWork.top);
        structure.ptMinTrackSize.x = (int) MinWidth;
        structure.ptMinTrackSize.y = (int) MinHeight;
      }
      Marshal.StructureToPtr(structure, lParam, true);
    }