Ejemplo n.º 1
0
        private void WindowFinder_MouseUp(object sender, MouseEventArgs e)
        {
            EndSearch();

            if (e.Button == MouseButtons.Right)
            {
                // we treat right mouse as cancel
                window.SetWindowHandle(original_hwnd_);
            }
            else
            {
                InvokeActiveWindowChanged();
            }
        }
Ejemplo n.º 2
0
        private void WindowFinder_MouseMove(object sender, MouseEventArgs e)
        {
            if (!searching)
            {
                EndSearch();
            }

            // Grab the window from the screen location of the mouse.
            POINT  windowPoint = POINT.FromPoint(this.PointToScreen(new Point(e.X, e.Y)));
            IntPtr found       = WindowFromPoint(windowPoint);

            // we have a valid window handle
            if (found != IntPtr.Zero)
            {
                // give it another try, it might be a child window (disabled, hidden .. something else)
                // offset the point to be a client point of the active window
                if (ScreenToClient(found, ref windowPoint))
                {
                    // check if there is some hidden/disabled child window at this point
                    IntPtr childWindow = ChildWindowFromPoint(found, windowPoint);
                    if (childWindow != IntPtr.Zero)
                    {                     // great, we have the inner child
                        found = childWindow;
                    }
                }
            }

            // Is this the same window as the last detected one?
            if (found != window.DetectedWindow)
            {
                window.SetWindowHandle(found);
                Trace.WriteLine("FoundWindow:" + window.Name + ":" + window.Text + " Managed:" + window.IsManaged);
                InvokeActiveWindowChanged();
            }
        }
Ejemplo n.º 3
0
        private void HighlightWindow()
        {
            if (!(SelectedObject is Control))
            {
                return;
            }

            IntPtr handle = ((Control)SelectedObject).Handle;

            if (handle != IntPtr.Zero)
            {
                highlightWindowProperties.SetWindowHandle(handle, Point.Empty);
            }
        }