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

atfeel 2016-02-29 06:56:21
我现在已经能做到使用 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);
}

}



怎么MSAA技术获取对象时返回该对象的够柄??
...全文
240 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
Saleayas 2016-03-01
  • 打赏
  • 举报
回复
这个是窗口的句柄。HWND
atfeel 2016-03-01
  • 打赏
  • 举报
回复
没有人知道吗

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧