易截截图软件、单文件、免安装、纯绿色、仅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发送焦点移动消息的函数及参数


procedure TForm_BaseMDI.FormKeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then
     begin
     Key := #0;
     SendMessage(Handle, 48384, 9, 0);     
     end;
end; ......

Delphi Excel to Sql Server

 unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, Grids, DBGrids, DB, ADODB,comobj, OleServer,
  ExcelXP;
type
  TForm1 = class(TForm)
    ADOConn: TADOConnection;
& ......

Delphi双向链表类

unit DvsLinkingClass;
interface
uses
Windows, Messages, SysUtils, Classes, Controls, Forms, Dialogs;
type
PRecLinkNode = ^RecLinkNode;
RecLinkNode = record
NodeMsg: String;
Counter: Integer;
Previous: PRecLinkNode;
Next: PRecLinkNode;
end;
TLinkingClass = class
......

Delphi 资源


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

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号