<!--CodeS-->
// 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;
<!--CodeE-->
Help 에 있습니다. 아래는 도움말에서 발취한것입니다.
<!--CodeS-->
// 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;
<!--CodeE-->