打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
ElementFromPoint?
Hi friend,
    I have encountered a problem when use IHTMLDocument2::ElementFromPoint
function. It works fine with noframe document. But with dealing with
FrameSet, I find it is difficult to give the document the correct point.
 Is there a function that could convert the point to the client's , the
individual frame, coordinates?


You need to drill down the frame hierarchy yourself. elementFromPoint
returns a frame element if the point falls inside a frame or iframe. You
can find out whether this is the case by querying the element for
IWebBrowser2. If this succeeds, you have the WebBrowser object
representing the frame. Get its document, call elementFromPoint. It may
or may not be yet another frame. Repeat.
--
With best wishes,
    Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken



Thanks. In my case, I can get the subframe, but still have problem get the
correct element. Because when I do an elementFromPoint on the frameset's
IHTMLDocument, the point is regarded as in this document's client
coordinates. I don't know how to convert from the parent frame's coordinate
to the client's. I have tryed to get IWebBrowser2 of the frameset and call
IWebBrowser2::get_Left, IWebBrowser2:get_Top,... found the returned value is
not what I need.

Best Regards



elementFromPoint on the top-level document gives you the frame element.

You need to find out its coordinates relative to owning document. Then
you call elementFromPoint on the frame's document with adjusted
coordinates.


--
With best wishes,
    Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken


本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
获取IE (控件)的所有链接(包括Frameset, iframe)
frame HTML元素
delphi WebBrowser获取iframe页面内容
C#中webBrowser加载页面中访问不同域的iFrame引发System.UnauthorizedAccessException异常的解决办法
TWebBrowser访问IFrame
利用WebBrowser彻底解决Web打印问题
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服