易截截图软件、单文件、免安装、纯绿色、仅160KB

delphi中application.processmessages的作用


delphi中application.processmessages的作用

procedure TForm1.Button2Click(Sender: TObject);
var
   I, J, X, Y: Word;
begin
   I := 0;
   J := 0;
   while I < 64000 do
   begin
     Randomize;
     while J < 64000 do
     begin
       Y := Random(J);
       Inc(J);
      Application.ProcessMessages;
     end;
     X := Random(I);
     Inc(I);
   end;
   Canvas.TextOut(10, 10, 'The Button2Click handler is finished');
end;
代码中红色的一行的作用:
如果你运行一个非常耗时的循环,那么在这个循环结束前,你的程序可能不会响应任何事件,你按按钮没有反应,程序设置无法绘制窗体,看上去就如同死了一样,
这有时不是很方便,例如于终止循环的机会都没有了。这时你就可以在循环中加上这么一句,每次程序运行到这句时,程序就会让系统响应一下消息,从而使你有机
会按按钮,窗体有机会绘制。


相关文档:

Delphi文件操作

 unit unitFileOP;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
implementation
function GetSys32Dir:String;
var
Sys32Dir: string;
pSys32Dir: array[0..Max_Path] of char;
begin
GetSystemDirectory(pSys32Dir,Max_Pat ......

Delphi 资源


 关于IntraWeb程序在编译时出现错误的解决方法
错误提示:[Error] IWLicenseKey.pas(12): Undeclared identifier: 'SetLicenseKey'
处理方法:进入菜单Tools->Environment Options,选择‘Library’,将'Library path'参数中有关intraweb的目录放在前面即可。
使用&n ......

delphi中用ado连接oracle 10g

2009-12-01  00:41:35
之前安装了oracle 10g,后来为了在C#里面连接oracle,安装了ODAC,之后连接数据库时,填写数据库服务名,总是会出错,连接测试无法通过,不填数据库服务名,倒还可以通过连接测试
今晚终于查到原因了。。。
系统属性那里的环境变量,path这里,oracle的两个默认路径:
d:\oracle\product\10. ......

Delete Delphi temporary file

Rem Delete Delphi temporary file
Rem ****************************
@echo Delete Delphi temporary file
@dir/w/s *.~*
@echo 以上为当前目录及子目录临时文件,请按任意键确认删除!
@pause
@for /r . %%a in (.) do @if exist "%%a\*.~*" del "%%a\*.~*"
@echo 删除成功!
@pause
Rem ************************* ......

Delphi实现透明窗体

unit unitMain;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号