Windows用户界面自动化不显示所有子元素? [英] Windows UI Automation not showing all child elements?

查看:121
本文介绍了Windows用户界面自动化不显示所有子元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的窗体上的TreeView控件,而且我递归另一个窗口的开始窗口本身的元素去。我使用这个找到的元素:

I have a TreeView control on my form, and I'm recursively going through the elements of another window starting with the window itself. I'm using this to find the elements:

getRecursiveElements(AutomationElement parent)
{
  children = parent.FindAll(TreeScope.Children, Condition.TrueCondition);

  foreach (AutomationElement child in children)
  {
    addToTreeView(child);
    getRecursiveElements(child);
  }
}



一般而言,代码工作得很好在大多数情况下。树是人口和我都有点等配套代码让我双击,例如,一个元素的树视图,它会选择目标表格上的元素。

Generally speaking, the code works quite well in most cases. The tree is populated and I have a bit of other supporting code allowing me to double click, for example, an element in the tree-view and it will highlight that element on the target form.

我遇到的问题是,虽然它生成一个真棒树,还有人仍下落不明的某些目标程序的一些元素。

The issue I'm having is that, while it generates an awesome tree, there are still some elements missing for certain target programs.

什么可能的原因莫不是这一点,是有什么办法解决呢?
。如果我称之为 EnumChildWindows()从有同样的问题user32.dll中的意志?

What possible reason could there be for this, and is there any way to get around it? If I call EnumChildWindows() from user32.dll will that have the same problem?

推荐答案

并非所有程序都使用他们所有的逻辑孩子单独窗口控件。大多数情况下这取决于使用的GUI框架。

Not all programs use separate windowed controls for all their logical children. Mostly this depends on the GUI framework used.

作为一个极端的例子,Qt针对每一个顶层窗口一个窗口。即采取这种方式然后,它描绘从该窗体的WM_PAINT消息处理程序窗体上的所有窗口小部件。

As an extreme example, Qt uses a single window for each top-level window. It then paints all the widgets on the form from the form's WM_PAINT message handler.

程序通常不可能通过一般的方法来实现自动化。

Programs that take this approach are typically impossible to automate through generic methods.

这听起来像你可能遇到了使用了一些窗口控制的应用程序,而且使用自定义的控件与什么似乎是多个小部件一个窗口。再次,这是相当普遍的。

It sounds like you have encountered an application that uses some windowed controls but also uses custom controls with a single window for what appears to be multiple widgets. Again this is quite common.

这篇关于Windows用户界面自动化不显示所有子元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆