atfeel
atfeel
2016-03-01 02:53

Active Accessibility 接口技术 遍历元素,如何取得句柄

  • msaa

我现在已经能做到使用 Active Accessibility 接口技术 遍历元素出IE里面所有元素了,但是不知道如何取对应的句柄

这个微软的SPY++的截图,他就能取到句柄

这是我的部分代码

foreach (var childChild1 in clientChilren)
{
if (childChild1.GetType().ToString().IndexOf("Object") > -1)
{
IAccessible childChild = (IAccessible)childChild1;
accRole = (int)childChild.get_accRole(CHILDID_SELF);
accName = childChild.get_accName(CHILDID_SELF);
childChild.accLocation(out nLeft, out nTop, out nWidth, out nHeight, CHILDID_SELF);

                         //IntPtr handler = IntPtr.Zero;
                        此API不对,获取所有所有元素句柄都一样,而SPY里真正获取到的句柄是不一样的
                        //WindowFromAccessibleObject(childChild,ref handler);

                        Console.WriteLine("1--- "+ handler + " , " + accRole + " , " + accName + "," + nLeft + "," + nTop + "," + nWidth + "," + nHeight);
                    }
                    else
                    {
                        Console.WriteLine(clientChilren);
                    }

                }

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答

为你推荐

换一换