本文整理自网络,侵删。
procedure IterateFrames(const AWB: IWebBrowser2);varDoc: IHTMLDocument2;Container: IOleContainer;Enumerator: ActiveX.IEnumUnknown;Unknown: IUnknown;Browser: IWebBrowser2;Fetched: Longint;NewDoc: IHTMLDocument2;beginif (Assigned(AWB.Document)) and (Supports(AWB.Document, IHTMLDocument2, Doc)) thenbegin// Recursive searching.// ACHTUNG! We cannot use the document's frames collection here, because// it does not work in every case (i.e. Documents from a foreign domain).// From: support.microsoft.com/support/kb/articles/Q196/3/40.ASPif (Supports(Doc, IOleContainer, Container)) and (Container.EnumObjects(OLECONTF_EMBEDDINGS, Enumerator) = S_OK) thenbeginwhile Enumerator.Next(1, Unknown, @Fetched) = S_OK doif (Supports(Unknown, IWebBrowser2, Browser)) and (Supports(Browser.Document, IHTMLDocument2, NewDoc)) thenbegin//DoSomethingWithNewDoc;IterateFrames(AWB);end;end;end;end;
来源:https://www.cnblogs.com/honeynm/p/4653651.html
相关阅读 >>
Delphi 格式化输出函数(2): formatdatetime
Delphi用twebbrowser组件在Delphi中post数据和取得网页源文件
Delphi 获得用android应用程序触摸到的位置(坐标)的方法
Delphi twebbrowser get html source after ajax load
更多相关阅读请进入《Delphi》频道 >>