先在WebBrowser 的事件中找到 OnDocumentComplete 并在里面写代码如下:
如下:
procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject; const pDisp: IDispatch; var URL: OleVariant); begin tag:=1 end;
在使用WebBrowser打开网站的同时加入以下代码:
tag:=0; // 这里写打开web代码 while(tag=0) do Application.ProcessMessages; Web1.oleobject.Document.body.Scroll:='no'; try doc := Web1.Document as IHTMLDocument2; if doc = nil then Exit; except end;
加入以上代码后,在下面写代码。这样不加载完就不会执行下面的代码!
标签:delphi
发表评论