在wpf中所有automationelement截图怎么走吗?



我创建了一个wpf应用程序,它获取并显示监视器的屏幕截图。我想在截图中获得所有自动化元素,所以我调用findall() withtreescope_children。但它返回的是显示器中所有窗口的元素,而不是截图时桌面上的窗口。如果我想在截图中找到元素。我该如何设定条件?

private Condition ChildrenCondition = new NotCondition(new PropertyCondition(
WindowPattern.WindowVisualStateProperty,
WindowVisualState.Minimized));
AutomationElementCollection ac = topElement.FindAll(TreeScope.Children, ChildrenCondition);

有一个库超越UIA或MSAA,你可以记录一个元素或一个窗口,然后可以得到孩子或迭代兄弟元素。clicknium .

https://marketplace.visualstudio.com/items?itemName=ClickCorp.clicknium

最新更新