Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure MyProc;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
count: integer;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Inc(count);
if Timer1.Enabled then
Timer1.Enabled := FALSE;
MyProc;
Timer1.Enabled := TRUE;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
count:=0;
end;
procedure TForm1.MyProc;
begin
showmessage(IntToStr(count));
end;
end.
размести на форме компонент TTimer, задай интервал времени в свойстве TTimer.Interval (в милисекундах);
код выводит количество вызовов метода MyProc