본문 바로가기
Delphi, RadStudio

[delphi/web] how to detect when a Document is comp...

by SB리치퍼슨 2016. 7. 5.

[delphi/web] how to detect when a Document is comp...



2004.01.12


An other example:

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 = nil then
    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;

cu Andries

반응형

댓글