LAN Web TCP Delphi

Title: How to use TWebBrowser.OnDocumentComplete with Frames
Question: When loading a page based on different frames into webbrowser
control, "ONDocumentComplete" fires each time one of the frames gets completed. How can I find out, when this last Point is reached and get this final url?
Answer:
procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
var
CurWebrowser: IWebBrowser;
TopWebBrowser: IWebBrowser;
Document: OleVariant;
WindowName: string;
begin
CurWebrowser := pDisp as IWebBrowser;
TopWebBrowser := (Sender as TWebBrowser).DefaultInterface;
if CurWebrowser = TopWebBrowser then
ShowMessage('Complete document was loaded')
else
begin
Document := CurWebrowser.Document;
WindowName := Document.ParentWindow.Name;
ShowMessage(Format('Frame "%s" was loaded', [WindowName]));
end;
end;
Found it on Swiss Delphi Center !