Код:
var
url: OleVariant;
begin
url:='http://www.delphisources.ru/';
WebBrowser.Navigate2(url);
while WebBrowser.ReadyState<>READYSTATE_COMPLETE do Application.ProcessMessages;
end;
а это из файла справки Delphi 6:
Цитата:
This example shows how to detect when a document is completely loaded, even if it includes multiple frames. Only the final OnDocumentComplete event passes the same Dispatch interface as the OnNavigateComplete event handler.
Код:
var
CurDispatch: IDispatch; {save the interface globally }
procedure TForm1.WebBrowser1NavigateComplete2(Sender: TObject; const pDisp: IDispatch; var URL: OleVariant);
begin
if CurDispatch = nilthen
CurDispatch := pDisp; { save for comparison }
end;
procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject; const pDisp: IDispatch; var URL: OleVariant);
begin
if (pDisp = CurDispatch) then
begin
Beep; {the document is loaded, not just a frame }
CurDispatch := nil; {clear the global variable }
end;
end;
|