Beispiel #1
0
        public void ShowOneElement()
        {
            Thread.Sleep(3000);
            POINTAPI point = new POINTAPI();

            WinAPI.GetCursorPos(ref point);
            this.ShowElementText.Text = string.Format("X:{0},Y:{1}\n", point.X.ToString(), point.Y.ToString());
            IntPtr                     intPtr       = WinAPI.WindowFromPoint(point.X, point.Y);
            AutomationElement          startElement = AutomationElement.FromHandle(intPtr);
            List <UIAutomationElement> list         = FindElement.GetElementList(startElement, point.X, point.Y);

            for (int i = 0; i < list.Count; i++)
            {
                AppendText(list[i], i);
            }
        }
 public static AutomationElement GetWindowElementByPoint(int x, int y)
 {
     return(AutomationElement.FromHandle(WinAPI.WindowFromPoint(x, y)));
 }