本文整理自网络,侵删。
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 d10.x 在android 9及更高版本下使用Delphi获取设备序列号?
Delphi 获取本机 hostname ip address
Delphi combobox 只读 text属性可用的方法
更多相关阅读请进入《Delphi》频道 >>