private void MouseHook_LeftButtonDown(MouseHook.MSLLHOOKSTRUCT mouseStruct) { System.Windows.Point point = new System.Windows.Point(); point.X = mouseStruct.pt.x; point.Y = mouseStruct.pt.y; mouseHook.Uninstall(); AutomationElement ae = AutomationElement.FromPoint(point); Stack <AutomationElement> automationElements = XmlController.MakeStack(ae); String result = XmlController.MakeXmlFile(automationElements, 0, null); mainWindow.XmlBox.Text = result; mainWindow.Activate(); }