怎样解决这个问题???(全部给了)(137分)

  • 主题发起人 主题发起人 yobdrow
  • 开始时间 开始时间
Y

yobdrow

Unregistered / Unconfirmed
GUEST, unregistred user!
我用twebbrowser控件访问网页,如何控制程序在等待网页完全下载后再进行处理
多线程新手,请教各位高手,谢谢
 
大虾们帮帮忙
进来的朋友帮忙翻翻贴也十分感谢,很急
 
这是一个不太完美的方案,并没有用到多线程:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, SHDocVw, StdCtrls;
type
TForm1 = class(TForm)
WebBrowser1: TWebBrowser;
EditAddress: TEdit;
ButtonGo: TButton;
ButtonStop: TButton;
procedure ButtonGoClick(Sender: TObject);
procedure ButtonStopClick(Sender: TObject);
private
{ Private declarations }
FDownAbort: Boolean;
public
{ Public declarations }
end;

var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.ButtonGoClick(Sender: TObject);
var
I: Integer;
begin
ButtonGo.Enabled := False;
try
FDownAbort := False;
WebBrowser1.Navigate(EditAddress.Text);
while (WebBrowser1.ReadyState <> READYSTATE_COMPLETE) and not FDownAbortdo
for I:= 0 to 1000do
Application.ProcessMessages;
if WebBrowser1.ReadyState = READYSTATE_COMPLETE then
ShowMessage('DownFinished')
else
ShowMessage('DownStopped');
finally
ButtonGo.Enabled :=True;
end;
end;

procedure TForm1.ButtonStopClick(Sender: TObject);
begin
WebBrowser1.Stop;
FDownAbort := True;
end;

end.
 
谢谢楼上朋友,我先实验一下
 
接受答案了.
 

Similar threads

D
回复
0
查看
802
DelphiTeacher的专栏
D
D
回复
0
查看
747
DelphiTeacher的专栏
D
D
回复
0
查看
696
DelphiTeacher的专栏
D
D
回复
0
查看
753
DelphiTeacher的专栏
D
D
回复
0
查看
659
DelphiTeacher的专栏
D
后退
顶部