LegacyI在Windows中可访问. [英] LegacyIAccessible in Windows.Automation

查看:125
本文介绍了LegacyI在Windows中可访问.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用C#获取AutomationElement的LegacyIAccessible.State和其他LegacyIAccessibles? 就像工具中的Inspect.exe一样.

How to obtain LegacyIAccessible.State and others LegacyIAccessibles of AutomationElement with C# ? just like Inspect.exe from tools makes it.

推荐答案

LegacyIAccessible是新增功能,与.NET 4.0中一样,它在.NET级别中不可用.但是在CodePlex上有一个项目,该项目的更新实现在

The LegacyIAccessible is new and is not available in the .NET level as is in .NET 4.0. But there is a project on CodePlex that has a newer implementation that in change set 38718 added support for this.

请注意,您必须从源代码编译项目,最新的二进制发行版太旧,无法包含此文件...

Be beware that you have to compile the project from source, the latest binary release is too old to contain this unfortunately...

您要执行的操作类似于:

What you want to do is something like:

if ((bool) child.GetCurrentPropertyValue(AutomationElementIdentifiers.IsLegacyIAccessiblePatternAvailableProperty)) {
    var pattern = ((LegacyIAccessiblePattern) child.GetCurrentPattern(LegacyIAccessiblePattern.Pattern));
    var state = pattern.GetIAccessible().accState;

    // Do something with state...
}

源代码中的注释说这些是Windows 7的新功能,但我认为它可以在Windows XP SP3上使用...

The comments in the source code says that these are new features for Windows 7, but I get it to work on Windows XP SP3...

希望这会有所帮助!

/AZ

这篇关于LegacyI在Windows中可访问.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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