欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
mshtml and frames/iframes
393,897 Members | 2,084 Online
Join Now
login
+ Ask Question
HomeQuestionsArticlesBrowse TopicsLatestTop MembersFAQ
home >topics >c# / c sharp >questions > mshtml and frames/iframes
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 393,897 IT Pros & Developers. It's quick & easy.
mshtml and frames/iframes
P: n/a
michelqa
Hi,
I'm doing a kind of control picker like the one in spy++ but for html
document.
When the control picker is over an IFRAME, the mshtml function
ElementFromPoint return an IFrame element.
How can I identify this particular frame/iframe in the frame
collection??? I can only select frame in the framecollection by using
the index or the frame name but the frame name is not always defined.
This is the part of code that try call recursivly
ElementFromPoint...only the last section of the code is releated to my
question
using mshtml;
//..
//--- Get document
IHTMLDocument2 HtmlDoc;
IHTMLDocument3 HtmlDoc; // to get HtmlDoc3.documentElement.ScrollTop,
ScrollLeft
HtmlDoc = GetIHTMLDocumentFromHandle(found); /found=internet
explorer_server handle
HtmlDoc3 = GetIHTMLDocumentFromHandle(found);
//--- Get the elementfromPoint in the main page
IHTMLElement Element;
Point pt;
pt = new Point(Control.MousePosition.X, Control.MousePosition.Y);
ScreenToClient(found, ref pt);
Element = HtmlDoc.elementFromPoint((int)pt.X, (int)pt.Y);
//--- Determine real element size and position relative to the main
page.
int ElementLeft = Element.offsetLeft;
int ElementTop = Element.offsetTop;
mshtml.IHTMLElement TmpElem = Element.offsetParent;
while (TmpElem != null)
{
ElementLeft = ElementLeft + TmpElem.offsetLeft;
ElementTop = ElementTop + TmpElem.offsetTop;
TmpElem = TmpElem.offsetParent;
}
//--- Highlight element
HighlightHtmlElement(found, ElementLeft - ScrollLeft, ElementTop -
ScrollTop, (int)Element.offsetWidth, (int)Element.offsetHeight);
//This is where my nightmare begins
if (Element.TagName.ToString().ToLower()=="iframe")
{
// Need to get an IHtmlDocument2 that point to the correct frame.
FramesCollection frm = (mshtml.FramesCollection)HtmlDoc.frames;
for (int Cnt=0;Cnt<frm.Length)
{
object FrameRefIndex=Cnt; //This is the
mshtml.IHTMLWindow2 HtmlWin = (mshtml.IHTMLWindow2)frm.item(ref
FrameRefIndex);
Trace.write("Inner html of the
iframe="+HtmlWin.Document.Body.InnerHtml.ToString( ));
// If (the framed document is the one contained in the iframe
tag returned by ElementFromPoint)
// doing my stuff to highlight the elements
}
}
MY QUESTION : In the last line of code it look like there is no way to
identify which framed document is associated with my iframe element
returned by ElementFromPoint.
I'm desesperatively working on this frame issue since many many many
many hours :( Really need help of an mshtml good samaritin expert.
Thanks
Sep 15 '08 #1
Post Reply
Share this Question
1 Reply
P: n/a
michelqa
On Sep 15, 1:51*am, michelqa <miche...@yahoo.cawrote: Hi,
*I'm doing a kind of control picker like the one in spy++ but for html
document.
When the control picker is over an IFRAME, *the mshtml function
ElementFromPoint return an IFrame element.
How can I identify this particular frame/iframe in the frame
collection??? I can only select frame in the framecollection by using
the index or the frame name but the frame name is not always defined.
This is the part of code that try call recursivly
ElementFromPoint...only the last section of the code is releated to my
question
using mshtml;
//..
//--- Get document
IHTMLDocument2 HtmlDoc;
IHTMLDocument3 HtmlDoc; // to get HtmlDoc3.documentElement.ScrollTop,
ScrollLeft
HtmlDoc = GetIHTMLDocumentFromHandle(found); * /found=internet
explorer_server handle
HtmlDoc3 = GetIHTMLDocumentFromHandle(found);
//--- Get the elementfromPoint in the main page
IHTMLElement Element;
Point pt;
pt = new Point(Control.MousePosition.X, Control.MousePosition.Y);
ScreenToClient(found, ref pt);
Element = HtmlDoc.elementFromPoint((int)pt.X, (int)pt.Y);
//--- Determine real element size and position relative to the main
page.
int ElementLeft = Element.offsetLeft;
int ElementTop = Element.offsetTop;
mshtml.IHTMLElement TmpElem = Element.offsetParent;
while (TmpElem != null)
{
* * * * ElementLeft = ElementLeft + TmpElem.offsetLeft;
* * * * ElementTop = ElementTop + TmpElem.offsetTop;
* * * * TmpElem = TmpElem.offsetParent;
}
//--- Highlight element
HighlightHtmlElement(found, ElementLeft - ScrollLeft, ElementTop -
ScrollTop, (int)Element.offsetWidth, (int)Element.offsetHeight);
//This is where my nightmare begins
if (Element.TagName.ToString().ToLower()=="iframe")
{
* * // Need to get an IHtmlDocument2 that point to the correct frame.
* * FramesCollection frm = (mshtml.FramesCollection)HtmlDoc.frames;
* * for (int Cnt=0;Cnt<frm.Length)
* * {
* * * *object FrameRefIndex=Cnt; * *//This is the
* * * *mshtml.IHTMLWindow2 HtmlWin = (mshtml.IHTMLWindow2)frm.item(ref
FrameRefIndex);
* * * *Trace.write("Inner html of the
iframe="+HtmlWin.Document.Body.InnerHtml.ToString( ));
* * * *// If (the framed document is the one contained in the iframe
tag returned by ElementFromPoint)
* * *// doing my stuff to highlight the elements
* *}
}
MY QUESTION : In the last line of code it look like there is no way to
identify which framed document is associated with my iframe element
returned by ElementFromPoint.
I'm desesperatively working on this frame issue since many many many
many hours :( *Really need help of an mshtml good samaritin expert.
ThanksThe only way I can imagine is to manually scan all document element...
pseudo maybe look like this :
FrameIndex=0
foreach element in the document
{
if (elment TagName="iframe" or "frame")
{
if the element got the same offsetleft an offsettop as the item
returned by elementfrompoint= break the loop
FrameIndex++
}
FrameIndex will be my frameindex and now i will ***MAY*** be able to
identify the right frame....
but this assume that the frame collection parse all the frame exactly
the same way as my application when parsing each element and counting
my own index
I'm sure it's not the right way to do this :(
Sep 15 '08 #2
This discussion thread is closed
Start new discussion
Replies have been disabled for this discussion.
Browse more C# / C Sharp Questions on Bytes
Question stats
viewed: 3472
replies: 1
date asked: Sep 15 '08
Follow this discussion
Similar topics
Frames in ASP.NET
frames, iframes VS. divs + AJAX
MSHTML + frames question
SmartNav.js vs. InternetExplorer doc. from shdocvw and mshtml
Frames in MSHTML
Using frames / iframes
iFrames Page load
iframe help - change two iframes with one click
what is iFrames ?
BYTES.COM ? 2014
Formerly "TheScripts.com" from 2005-2008
About Bytes |Advertise on Bytes |Contact Us
Sitemap |C# / C Sharp Answers Sitemap |C# / C Sharp Insights Sitemap
Follow us to get the Latest Bytes Updates
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
MFC C++代碼與WebBrowser HTML的互動(dòng)(還需完善)
C#中webBrowser加載頁(yè)面中訪(fǎng)問(wèn)不同域的iFrame引發(fā)System.UnauthorizedAccessException異常的解決辦法
iframe HTML元素
python selenium系列(九)元素定位進(jìn)階之多層框架定位
python selenium的frame表單切換
判斷網(wǎng)頁(yè)是否在iframe或frame中-YAOYOA
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久