Hi there,
I started to use the C++ API for UI Automation a couple of weeks ago. So I'm still quite a newbie. I was able to achieve some things, that I couldn't do by using the managed C# version, so that's already great. I just ran into a couple of issues related to a quite bad performance. I hope somebody is able to point me in the right direction or even can explain me how to do things better, respectively where I made mistakes.
1. In the documentation for the tree walker is written that you should not use the root element for the entry point, so I selected the calculator as a hard coded entry point for my proof of concept. I got the name from INSPECT and used IUIAutomationElement::FindFirst to locate it and run the tree walker to print all children from there. FindFirst unfortunately needs like 70sec or something to locate the calculator, I assume it has to walk the whole tree. So where is the point in not walking the whole tree myself in the first place? Am I missing something here? When I executed the tree walking twice, the second execution also took double the time, so should I cache it myself?
2. I implemented the FocusChangedEventHandler and StructureChangedEventHandler like it's described here: https://msdn.microsoft.com/en-us/library/windows/desktop/ff625914(v=vs.85).aspx that worked finde. Then I added an implementation for some general events like the top most example at before mentioned how to. That worked not as good. Every time I add a new event handler it needs +60 seconds, so the first is executed in approx. 0 sec, the next is added within 60sec, the third in 120sec, fourth 180sec,... And I triple checked if I did a timeout or something myself, but I couldn't find one. Does anyone know where that comes from?
Thanks everyone, I'd really appreciate if you could help me :)