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
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。