积极答复者
如何获取WebBrowser上的当前光标位置?

问题
答案
-
你可以参考http://www.codeproject.com/KB/DLL/PasswordSPY.aspx
IE的网页视图里面的元素都是自己画的,COM事件也是自己触发的,不会发通知消息到其他窗口。
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
Visual C++ MVP
- 已编辑 Sheng Jiang 蒋晟Moderator 2011年10月24日 17:41
- 已标记为答案 Alan_chenModerator 2011年10月31日 2:00
全部回复
-
你可以用MSAA做一个hit test
参考Inspect
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
Visual C++ MVP -
老大,能在稍微展开一点吗?
我查了一下说明,貌似这个功能有些相关,但它的描述是已知坐标找课件的控件,不知道对于WebBrowser里面的iframe能否适用?
The IAccessible::accHitTest method retrieves the child element or child object that is displayed at a specific point on the screen. All visual objects support this method, but sound objects do not. Client applications rarely call this method directly; to get the accessible object that is displayed at a point, use theAccessibleObjectFromPoint function, which calls this method internally.
如果适用的话,然后转换光标坐标为窗口的相对坐标,如果这个坐标在一个多层嵌套的iframe上,如何获取真正的元素呢??
本人刚入门C#,或者,有没有例子如何直接调用WinAPI,来获取移动过程中光标的位置??谢谢
- 已编辑 cylixhui 2011年10月18日 1:31
-
IE的框架是没有窗口的,AccessibleObjectFromPoint返回的是顶层框架的文档。你可以用IHTMLDocument2::elementFromPoint来检查指定地方的元素是否是框架,如果是的话,转换坐标再调用框架文档的elementFromPoint
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
Visual C++ MVP -
你可以参考http://www.codeproject.com/KB/DLL/PasswordSPY.aspx
IE的网页视图里面的元素都是自己画的,COM事件也是自己触发的,不会发通知消息到其他窗口。
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
Visual C++ MVP
- 已编辑 Sheng Jiang 蒋晟Moderator 2011年10月24日 17:41
- 已标记为答案 Alan_chenModerator 2011年10月31日 2:00