UIAutomation-Interop
UIAutomation-Interop copied to clipboard
desktop.GetLastChild() return too slow
I use code like this: IUIAutomation uia = new CUIAutomation8(); var desktop = uia.GetRootElement();
var walker = uia.RawViewWalker; List<IUIAutomationElement> result = new List<IUIAutomationElement>();
IUIAutomationElement tmp = walker.GetFirstChildElement(current); while (tmp != null) { if(condition == null || condition.Verify(tmp)) { result.Add(tmp); } tmp = walker.GetNextSiblingElement(tmp); }
when tmp to be set as the last child , then call walker.GetNextSiblingElement(tmp), it would be a long time to return null.
Or call: desktop .GetLastChildElement(), it speed too much time to return.
How can I quickly get all children of desktop ? Thanks very much.