Hi Kyle,
I meant that it's always freezing when i set a breakpoint and it stops at it. I'm usually doing it because i want to check the values in an object at the breakpoint. I think it's freezing because of the mousehook and the system has to process to much or something like that?!
To the argument exception:
I found out that it's excel related. I tested it in Chrome, IE, Word and only Excel throws the exception.
It also throws the exception by a default condition like the following:
Condition conditions = new AndCondition(new PropertyCondition(AutomationElement.IsEnabledProperty, true),
new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Pane));
I don't know, if i have to give up the idea but the search is to slow.
Even if i store the element after the element searching, i'm about +/- 80 milliseconds (the position is always changing, if it's an other workbook).
I don't know, if there's another way to search an element faster, may be something like searching by Win Api and after finding, cast the object to an UIA element?!