Показать сообщение отдельно
Старый 22.05.2004, 19:06     # 25
Hrudnel
Newbie
 
Регистрация: 08.01.2004
Сообщения: 18

Hrudnel Путь к славе только начался
Код:
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
__________________
Хорошая крыша летает сама
Hrudnel вне форума