/// <summary>
        /// Converts a point in client coordinates of a window to screen coordinates.
        /// </summary>
        /// <param name="hwnd">Handle to the window of the original point.</param>
        /// <param name="clientPoint">Point expressed in client coordinates.</param>
        /// <returns>Point expressed in screen coordinates.</returns>
        public static NPoint ClientToScreen(IntPtr hwnd, NPoint clientPoint)
        {
            NPoint localCopy = new NPoint(clientPoint);

            if (ClientToScreen(hwnd, ref localCopy))
                return localCopy;
            else
                return new NPoint();
        }
示例#2
0
        private static void InjectDoubleLeftMouseClick(IntPtr child, NPoint clientLocation)
        {
            IntPtr lParamClickLocation = MessagingMethods.MakeLParam(clientLocation.X, clientLocation.Y);

            MessagingMethods.PostMessage(child, WM.LBUTTONDBLCLK, new IntPtr(MK.LBUTTON), lParamClickLocation);

            #if DEBUG
            Console.WriteLine("Double left click on window #" + child.ToString() + " at " + clientLocation.ToString());
            #endif
        }
        /// <summary>
        /// Converts a point in screen coordinates in client coordinates relative to a window.
        /// </summary>
        /// <param name="hwnd">Handle of the window whose client coordinate system should be used.</param>
        /// <param name="screenPoint">Point expressed in screen coordinates.</param>
        /// <returns>Point expressed in client coordinates.</returns>
        public static NPoint ScreenToClient(IntPtr hwnd, NPoint screenPoint)
        {
            NPoint localCopy = new NPoint(screenPoint);

            if (ScreenToClient(hwnd, ref localCopy))
            {
                return(localCopy);
            }
            else
            {
                return(new NPoint());
            }
        }
        /// <summary>
        /// Converts a point in client coordinates of a window to screen coordinates.
        /// </summary>
        /// <param name="hwnd">Handle to the window of the original point.</param>
        /// <param name="clientPoint">Point expressed in client coordinates.</param>
        /// <returns>Point expressed in screen coordinates.</returns>
        public static NPoint ClientToScreen(IntPtr hwnd, NPoint clientPoint)
        {
            NPoint localCopy = new NPoint(clientPoint);

            if (ClientToScreen(hwnd, ref localCopy))
            {
                return(localCopy);
            }
            else
            {
                return(new NPoint());
            }
        }
示例#5
0
        /// <summary>Returns the child control of a window corresponding to a screen location.</summary>
        /// <param name="parent">Parent window to explore.</param>
        /// <param name="scrClickLocation">Child control location in screen coordinates.</param>
        private static IntPtr GetRealChildControlFromPoint(IntPtr parent, NPoint scrClickLocation)
        {
            IntPtr curr = parent, child = IntPtr.Zero;
            do {
                child = WindowManagerMethods.RealChildWindowFromPoint(curr,
                    WindowManagerMethods.ScreenToClient(curr, scrClickLocation));

                if (child == IntPtr.Zero || child == curr)
                    break;

                //Update for next loop
                curr = child;
            }
            while (true);

            //Safety check, shouldn't happen
            if (curr == IntPtr.Zero)
                curr = parent;

            return curr;
        }
 static extern bool ScreenToClient(IntPtr hwnd, ref NPoint point);
 static extern bool ClientToScreen(IntPtr hwnd, ref NPoint point);
 public static extern IntPtr RealChildWindowFromPoint(IntPtr parent, NPoint point);
示例#9
0
 private static extern bool GetCursorPosInternal(out NPoint point);
示例#10
0
 private static extern bool GetCursorPosInternal(out NPoint point);
示例#11
0
 public static extern IntPtr RealChildWindowFromPoint(IntPtr parent, NPoint point);
示例#12
0
 static extern bool ScreenToClient(IntPtr hwnd, ref NPoint point);
示例#13
0
 static extern bool ClientToScreen(IntPtr hwnd, ref NPoint point);
示例#14
0
        /// <summary>
        /// Converts a point in screen coordinates in client coordinates relative to a window.
        /// </summary>
        /// <param name="hwnd">Handle of the window whose client coordinate system should be used.</param>
        /// <param name="screenPoint">Point expressed in screen coordinates.</param>
        /// <returns>Point expressed in client coordinates.</returns>
        public static NPoint ScreenToClient(IntPtr hwnd, NPoint screenPoint)
        {
            NPoint localCopy = new NPoint(screenPoint);

            if (ScreenToClient(hwnd, ref localCopy))
                return localCopy;
            else
                return new NPoint();
        }
示例#15
0
        private static void InjectDoubleRightMouseClick(IntPtr child, NPoint clientLocation)
        {
            IntPtr lParamClickLocation = MessagingMethods.MakeLParam(clientLocation.X, clientLocation.Y);

            MessagingMethods.PostMessage(child, WM.RBUTTONDBLCLK, new IntPtr(MK.RBUTTON), lParamClickLocation);

            #if DEBUG
            System.Diagnostics.Debug.WriteLine("Double right click on window #" + child.ToString() + " at " + clientLocation.ToString());
            #endif
        }
示例#16
0
 public NPoint(NPoint copy)
 {
     X = copy.X;
     Y = copy.Y;
 }
示例#17
0
 public NPoint(NPoint copy)
 {
     X = copy.X;
     Y = copy.Y;
 }