`

Application.ProcessMessages

 
阅读更多

//如果有这样一个循环, 是非常可怕的; 因为它完不了, 你得等着.

procedure TForm1.Button1Click(Sender: TObject);

var

i: Integer;

begin

for i := 0 to MaxInt do

begin

Text := IntToStr(i);

end;

end;/

/即使这样也无济于事, 因为在循环期间你执行不了Button2Click

var

b: Boolean;

procedure TForm1.Button1Click(Sender: TObject);

var

i: Integer;

begin

b := True;

for i := 0 to MaxInt do

begin

if b then

Text := IntToStr(i)

else

Exit;

end;

end;

procedure TForm1.Button2Click(Sender: TObject);

begin

b := False;

end;

//如果在循环期间...

for i := 0 to MaxInt do

begin

if b then

Text := IntToStr(i)

else

Exit;

{看看还有其他什么事情发生}

end;

//Application.ProcessMessages 就是干这个的!

var b: Boolean;

procedure TForm1.Button1Click(Sender: TObject);

var

i: Integer;

begin

b := True;

for i := 0 to MaxInt do

begin

if b then

Text := IntToStr(i)

else

Exit;

Application.ProcessMessages;

{!}

end;

end;

procedure TForm1.Button2Click(Sender: TObject);

begin

b := False;

end;

分享到:
评论

相关推荐

    Application.ProcessMessages作用

    Application.ProcessMessages作用Application.ProcessMessages作用Application.ProcessMessages作用Application.ProcessMessages作用

    delphi 读取BIN文件

    Application.ProcessMessages; begin for i:=0 to j do begin form1.Label1.Caption:='正在读取第 '+inttostr(i)+' 包 '; form1.Memo1.Text:=form1.Memo1.Text+ midstr(strtohex(form1.Memo2.text),2048*i,...

    Application

    定时关机,服务控制器,截图工具,清理临时文件, 数据库备份,写字板

    Delphi WebBrowser 将一段HTML文字显示在浏览器中.rar

     while(tag=0) do Application.ProcessMessages;  vv := VarArrayCreate([0, 0], varVariant);  HTMLDocument := WebBrowser1.Document as IHTMLDocument2;  HTMLDocument.Write(PSafeArray(TVarData(vv).VArray...

    delphi 导出到excel的7种方法

    Application.ProcessMessages; end; tsList.Add(s); try try ADOQuery.First; While Not ADOQuery.Eof do begin s:=''; for y:=0 to ADOQuery.FieldCount-1 do begin s:=s+ADOQuery.Fields[y].AsString+...

    Delphi 图片颜色逐渐加深功能的实现.rar

    Delphi演示如何将一张图片的颜色加深,类似于调整对比度,不过本效果不加入了渐变加深的动画效果,按住按钮图片一直变暗下去,要知... Application.ProcessMessages; //让Application去处理消息队伍中的消息  end;

    delphi_进度条

    Application.ProcessMessages; end; procedure TFrmProgress.SetProgressMax(const Value: Integer); begin FProgressMax := Value; ProgressBar.Max:=FProgressMax; end; procedure TFrmProgress....

    Delphi 垂直交错显示效果.rar

    图片的垂直交错效果,Delphi 编写的图片垂直交错显示效果,之前就分享过这种效果,类似百叶窗的交替显示... Application.ProcessMessages;  end;  form1.Canvas.Draw(0,0,newbmp);  i:=i 2;  end;  newbmp.free;

    IdPOP3做的-QQ邮箱附件接收器

    批量下载QQ邮箱中的所有附件 procedure TFrm_QQMailRev.bt_revClick(Sender:... application.ProcessMessages; end; Label3.Caption := '共接收附件:['+intToStr(fCount)+'] '; IdPOP31.Disconnect; //断开连接 end;

    DELPHI搜索文件的示例

    Application.ProcessMessages; SearchFile1(List[I], Edit1.Text); ProgressBar1.Position := I; end; ListBox1.Items.Text := FileNameList.Text; ButtonSearchFile.Caption := IntToStr(FileNamePathList....

    INDY控件使用指南

    TIdAntiFreeze在Indy内部定时中断对栈的调用,并在中断期间调用Application.ProcessMessages方法处理消息,而外部的Indy调用继续保存阻塞状态,就好像TIdAntiFreeze对象不存在一样。你只要在程序中的任意地方添加一...

    DevExpress VCL 13.2.5 D7-DXE6 FullSource

    •Q580916 - An AV occasionally occurs when calling Application.ProcessMessages within the View's BeginUpdate/EndUpdate block •Q582957 - In Delphi 7, the grid configuration wizard doesn't add data ...

    DevExpress VCL 2012 vol 1.6源码、例子、帮助-Part2

    Q434679 - A layout group fires the OnTabChanging event twice if the event's handler calls Application.ProcessMessages Q433283 - A layout group with a label layout item that is set to occupy the ...

    DELPHI TXT 树文档 管理器

    unit TreeViewFunctions; interface uses Windows, Messages, SysUtils, Variants, Classes, ComCtrls, Controls, Forms, FileCtrl, StrUtils, Masks, Vcl.... if Application.MessageBox('确定要删除这个文件夹吗...

    DevExpress VCL v2012 vol 1.6源码、例子、帮助

    Q434679 - A layout group fires the OnTabChanging event twice if the event's handler calls Application.ProcessMessages Q433283 - A layout group with a label layout item that is set to occupy the entire...

    DevExpress VCL v2012 vol 1.6源码、例子、帮助-Part1

    Q434679 - A layout group fires the OnTabChanging event twice if the event's handler calls Application.ProcessMessages Q433283 - A layout group with a label layout item that is set to occupy the entire...

    DevExpress VCL v2012 vol 1.6源码、例子、帮助-part2

    Q434679 - A layout group fires the OnTabChanging event twice if the event's handler calls Application.ProcessMessages Q433283 - A layout group with a label layout item that is set to occupy the entire...

    DevExpress VCL 2012 vol 1.6源码、例子、帮助-Part1

    Q434679 - A layout group fires the OnTabChanging event twice if the event's handler calls Application.ProcessMessages Q433283 - A layout group with a label layout item that is set to occupy the ...

    DevExpress VCL v2012 vol 1.6源码-例子-帮助-part2

    Q434679 - A layout group fires the OnTabChanging event twice if the event's handler calls Application.ProcessMessages Q433283 - A layout group with a label layout item that is set to occupy the entire...

    DevExpress VCL v2012 vol 1.6源码-例子-帮助-part1

    Q434679 - A layout group fires the OnTabChanging event twice if the event's handler calls Application.ProcessMessages Q433283 - A layout group with a label layout item that is set to occupy the entire...

Global site tag (gtag.js) - Google Analytics