Ejemplo n.º 1
0
        void HotKeyManager_RunXMove(object sender, MouseEventExtArgs e)
        {
            var hWnd    = WinApi.WindowFromPoint(e.Location);
            var hParent = IntPtr.Zero;

            if (hWnd == IntPtr.Zero)
            {
                return;
            }
            while (true)
            {
                hParent = WinApi.GetParent(hWnd);
                if (hParent == IntPtr.Zero)
                {
                    break;
                }
                hWnd = hParent;
            }
            if (!WinApi.IsWindow(hWnd))
            {
                return;
            }

            WinApi.RECT r = new WinApi.RECT();
            WinApi.GetWindowRect(hWnd, out r);
            offsetMoveWindow = new Point(e.X - r.Left, e.Y - r.Top);
            hWndMoveWindow   = hWnd;
            isXMove          = true;
        }
        private static void HighlightFoundWindow(IntPtr hWnd)
        {
            var r = new WinApi.RECT();

            WinApi.GetClientRect(hWnd, out r);
            using (var g = Graphics.FromHwnd(hWnd))
                g.DrawRectangle(new Pen(Color.ForestGreen, 3),
                                r.Left, r.Top, r.Right - 1, r.Bottom - 1);
        }
Ejemplo n.º 3
0
 private static int getArea(SystemWindow sw)
 {
     WinApi.RECT rr = sw.Rectangle;
     return(rr.Height * rr.Width);
 }
Ejemplo n.º 4
0
 static extern bool GetWindowRect(IntPtr hWnd, out WinApi.RECT lpRect);