About the author
After weeks of no coding, I'm back on my feet again, doing some coding again... My quest this time: To loop through all the frames in a TWebBrowser.
Here's how to get the code below to find all the frames (regardless of level of nesting) in a TWebBrowser: FindFrame(WebBrowser1.Document);
procedure FindFrame(ADocument: IHTMLDocument2);var LDocument: IHTMLDocument2; LContainer: IOleContainer; LEnumerator: IEnumUnknown; LUnknown: IUnknown; LFetched: Longint; LBrowser: IWebBrowser2; LResult: HRESULT;begin if not Supports(ADocument, IOleContainer, LContainer) then exit; if not Succeeded(LContainer.EnumObjects(OLECONTF_EMBEDDINGS, LEnumerator)) then exit; while LEnumerator.Next(1, LUnknown, @LFetched)=S_OK do begin if Supports(LUnknown, IID_IWebBrowser2, LBrowser) then begin // Is a frame if Supports(LBrowser.Document, IID_IHTMLDocument2, LDocument) then begin Memo1.Lines.Add(LDocument.title); FindFrame(LDocument); LDocument := nil; end; LBrowser := nil; end; LUnknown := nil; end; LEnumerator := nil; LContainer := nil;end;
Learn why the map is cool in Go!
A method to design records so that they're allocated on a specific byte boundary, such as 16 bytes, 512 bytes, 4096 bytes, etc.
Learn the command line used to compile System.pas in Delphi
How to free more space on your home drive by redirecting the location for SDKs in RAD Studio