MSAA UI Automation get_accChildCount在Winforms中不正确地返回0,用于Infragistics UltraTree [英] MSAA UI Automation get_accChildCount Incorrectly Returning 0 for Infragistics UltraTree in Winforms

查看:855
本文介绍了MSAA UI Automation get_accChildCount在Winforms中不正确地返回0,用于Infragistics UltraTree的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在C#Winforms应用程序中工作自动化Infragistics UltraTree控件时,我发现UltraTree实现了AccessibleObject模型(MSAA)。我能够成功地抓取IAccessible接口,把从spy ++抓取的hwnd到

While working on automating an Infragistics UltraTree control in a C# Winforms application I found that the UltraTree implemented the AccessibleObject model (MSAA). I was able to successfully grab the IAccessible interface by putting the hwnd grabbed from spy++ into

IAccessible* accessibleObject;
AccessibleObjectFromWindow(hwnd, OBJID_CLIENT, IID_IAccessible, (void**)&accessibleObj);

问题是,当我现在调用

long childCount;
accessibleObj->get_accChildCount(&childCount);

我回来的结果是零。从UltraTree源代码看,我注意到它的子计数的实现不应该返回零(通过使用windbg来检查内部代码中使用的字段)。所有其他的MSAA功能似乎都正常工作(例如'accLocation')。

The result that I get back is zero. From looking at the UltraTree source code I noticed that its implementation of child count should not be returning zero (verified by using windbg to inspect the fields used in the internal code). All of the other MSAA functions seem to be working correctly (such as 'accLocation').

我被解释为什么会是这样。我也尝试使用'IEnumVARIANT',但类似地发现没有孩子,即使树在集合中有'get_accChildCount'利用25项。我还没有试图看看Microsoft Narrator是否能够识别孩子,因为机器没有声卡,但希望得到一个设置,尽快尝试。我的猜想是,旁观者会找到孩子,有一些奇怪的伎俩,我失踪了。

I am stumped as to why this would be the case. I also tried using 'IEnumVARIANT' as well, but that similarly found no children even though the tree has 25 items in the collection that 'get_accChildCount' utilizes. I haven't yet tried to see if Microsoft Narrator has been able to identify the children since the machine doesn't have a sound card, but hope to get a set up to try that soon. My guess is that Narrator will find the children and there is some weird trick that I am missing.

推荐答案

,但我最终发现通过运行在CLR(flipping / clr打开)正确的孩子数返回。所以字面上完全相同的代码,唯一的区别是是否指定/ clr编译器开关。我真的不想在CLR下运行这个代码,所以这对我来说不是一个理想的解决方案,但它在技术上回答我的问题。

Kind of a crummy answer, but I ended up finding that by running under the CLR (flipping /clr on) the correct number of children is returned. So literally same exact code with the only difference being whether or not the /clr compiler switch is specified. I really don't want to run this code under the CLR though so this isn't an ideal solution for me, but it does technically answer my question.

必须发布另一个问题,为什么会发生这种情况:(

I will have to post another question asking why this might be happening :(

这篇关于MSAA UI Automation get_accChildCount在Winforms中不正确地返回0,用于Infragistics UltraTree的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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