C# 如何检测Iframe是否已在C中加载#

C# 如何检测Iframe是否已在C中加载#,c#,.net,iframe,ihtmldocument2,C#,.net,Iframe,Ihtmldocument2,我想在HTML文档中标识是否加载了Iframe 以下是我尝试过的,但我不确定这是否是识别IFrame加载的正确方法: var myhtmlDocument = (IHTMLDocument2) HtmlDocument.DomDocument; IHTMLSelectionObject htmlselectionObject = myhtmlDocument.selection; bool frameloaded = false; if (htmlselectionObject != n

我想在HTML文档中标识是否加载了Iframe

以下是我尝试过的,但我不确定这是否是识别IFrame加载的正确方法:

 var myhtmlDocument = (IHTMLDocument2) HtmlDocument.DomDocument;
 IHTMLSelectionObject htmlselectionObject = myhtmlDocument.selection;
 bool frameloaded = false;
 if (htmlselectionObject != null)
  {
    FramesCollection frames = myhtmlDocument.frames;
    IHTMLSelectionObject frameSelection = frame.document.selection;
    for (int i = 0; i < frames.length; i++)
    {
       object index = i;
       IHTMLWindow2 frame = (IHTMLWindow2) frames.item(ref index);                                
       IHTMLSelectionObject frameSelection = frame.document.selection;

       if(frameSelection)
          frameloaded = true;
    }
 }
var myhtmlDocument=(IHTMLDocument2)HtmlDocument.DomDocument;
IHTMLSelectionObject htmlselectionObject=myhtmlDocument.selection;
bool frameloaded=false;
如果(HtmlSelectObject!=null)
{
FramesCollection frames=myhtmlDocument.frames;
IHTMLSelectionObject frameSelection=frame.document.selection;
对于(int i=0;i
我已经几十年不需要这样做了,但那时我们在
iframe
上挂起了一个
onload
事件,如果它最终加载了,我们必须检查它是否包含错误消息。我不知道这几天是否仍然相关