Example #1
0
 public static Screen FromPoint(Point point)
 {
     if (multiMonitorSupport)
     {
         var pt = new POINTSTRUCT((int)point.X, (int)point.Y);
         return(new Screen(MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST)));
     }
     return(new Screen((IntPtr)PRIMARY_MONITOR));
 }
Example #2
0
 public static Screen FromPoint(System.Drawing.Point point)
 {
     if (multiMonitorSupport)
     {
         POINTSTRUCT pt = new POINTSTRUCT(point.X, point.Y);
         return(new Screen(MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST)));
     }
     else
     {
         return(new Screen((System.IntPtr)PRIMARY_MONITOR));
     }
 }
Example #3
0
        public static IntPtr WindowFromPhysicalPoint(int x, int y)
        {
            POINTSTRUCT ps = new POINTSTRUCT(x, y);

            if (System.Environment.OSVersion.Version.Major >= 6)
            {
                return(IntWindowFromPhysicalPoint(ps));
            }
            else
            {
                return(IntWindowFromPoint(ps));
            }
        }
Example #4
0
//      [StructLayout(LayoutKind.Sequential,CharSet=CharSet.Auto, Pack=4)]
//      public class MONITORINFOEX {
//          public int     cbSize = Marshal.SizeOf(typeof(MONITORINFOEX));
//          public RECT    rcMonitor = new RECT();
//          public RECT    rcWork = new RECT();
//          public int     dwFlags = 0;
//          [MarshalAs(UnmanagedType.ByValArray, SizeConst=32)]
//          public char[]  szDevice = new char[32];
//      }

        public static void      GetMonitorFromPosition(Point _position, out Screen _containingScreen, out IntPtr _hMonitor)
        {
            _containingScreen = null;
            _hMonitor         = IntPtr.Zero;
            foreach (Screen screen in Screen.AllScreens)
            {
                if (screen.Bounds.Contains(_position))
                {
                    _containingScreen = screen;
                    break;
                }
            }
            if (_containingScreen == null)
            {
                throw new Exception("Provided position is not contained by any monitor!");
            }

            // Also retrieve the HMONITOR value
            POINTSTRUCT pt = new POINTSTRUCT(_position.X, _position.Y);

            _hMonitor = MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST);
        }
Example #5
0
 /// <summary>
 /// Get the screen containing the given point.
 /// </summary>
 public static Screen FromPoint(Point point)
 {
     var nativePoint = new POINTSTRUCT((int)point.X, (int)point.Y);
     return new Screen(User32WindowFunctions.MonitorFromPoint(nativePoint, MONITOR_DEFAULTTO.NEAREST));
 }
Example #6
0
 internal static extern int MapWindowPoints(HandleRef hWndFrom, HandleRef hWndTo, out POINTSTRUCT pt, int cPoints);
Example #7
0
 internal static extern bool GetCursorPos(out POINTSTRUCT pt);
Example #8
0
 private static extern IntPtr _ChildWindowFromPointEx(HandleRef hwndParent, POINTSTRUCT pt, int uFlags);
Example #9
0
 private static extern IntPtr _WindowFromPoint(POINTSTRUCT pt);
Example #10
0
 public static extern System.IntPtr MonitorFromPoint(POINTSTRUCT pt, int flags);
Example #11
0
 private static extern IntPtr _WindowFromPoint(POINTSTRUCT pt);
Example #12
0
 public static extern int UpdateLayeredWindow(IntPtr hwnd, IntPtr hdcDst, ref POINTSTRUCT pptDst, ref NativeMethods.SIZESTRUCT psize, IntPtr hdcSrc, ref POINTSTRUCT pprSrc, int crKey, ref NativeMethods.BLENDFUNCTION pblend, int dwFlags);
Example #13
0
 public static extern HandleRef MonitorFromPoint(POINTSTRUCT pt, int flags);
Example #14
0
 public static extern IntPtr _WindowFromPoint(POINTSTRUCT pt);
Example #15
0
 public static IntPtr WindowFromPoint(int x, int y)
 {
     POINTSTRUCT pointstruct1 = new POINTSTRUCT(x, y);
     return _WindowFromPoint(pointstruct1);
 }
 internal static extern IntPtr MonitorFromPoint(POINTSTRUCT pt, int flags);
 public static extern HandleRef MonitorFromPoint(POINTSTRUCT pt, int flags);
Example #18
0
        public static IntPtr WindowFromPoint(int x, int y)
        {
            POINTSTRUCT ps = new POINTSTRUCT(x, y);

            return(_WindowFromPoint(ps));
        }
Example #19
0
 public static extern IntPtr MonitorFromPoint(POINTSTRUCT pt, MonitorDefault flags);
Example #20
0
 private static extern IntPtr IntWindowFromPhysicalPoint(POINTSTRUCT pt);
Example #21
0
 public static IntPtr WindowFromPoint(int x, int y) {
     POINTSTRUCT ps = new POINTSTRUCT(x, y);
     return _WindowFromPoint(ps);
 }
Example #22
0
 public static IntPtr WindowFromPhysicalPoint(int x, int y)
 {
     POINTSTRUCT ps = new POINTSTRUCT(x, y);
     if (System.Environment.OSVersion.Version.Major >= 6)
         return IntWindowFromPhysicalPoint(ps);
     else
         return IntWindowFromPoint(ps);
 }
Example #23
0
 public static IntPtr ChildWindowFromPointEx(HandleRef hwndParent, int x, int y, int uFlags) {
     POINTSTRUCT ps = new POINTSTRUCT(x, y);
     return _ChildWindowFromPointEx(hwndParent, ps, uFlags);
 }
Example #24
0
 private static extern IntPtr IntWindowFromPhysicalPoint(POINTSTRUCT pt);
Example #25
0
        internal static IntPtr WindowFromPoint(Point p)
        {
            POINTSTRUCT ps = new POINTSTRUCT(p.X, p.Y);

            return(_WindowFromPoint(ps));
        }
Example #26
0
 static extern IntPtr MonitorFromPoint(POINTSTRUCT pt, int flags);