home *** CD-ROM | disk | FTP | other *** search
- unit Unit1;
-
- {
- Demo-Program for TLMDHiTimer.
-
- This program demonstrates the high resultion capabilities of the TLMDHiTimer-
- component. Here you can get a comparision how often a OnTimer Event is fired.
- By the spinbutton-control you're able to change the number of events which should
- be fired.
-
- This program is freeware. Use it and enjoy!
- If you made any improvements it would be nice to send them to us.
-
- ⌐ 1995 by LMD Innovative
-
- ------------------------------------------------------------------
- History:
- 0.01.00 (06.09.95): First Version
-
- Author: RM}
-
-
-
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, Lmdappl, lmdtips, Lmddir, Lmdsysin, Lmdabout, StdCtrls,
- Lmdhitim, ExtCtrls, Lmdfile, CtcBase, CtcFBase, CtcFile, Gauges, Spin;
-
- type
- TForm1 = class(TForm)
- LMDHiTimer1: TLMDHiTimer;
- Timer1: TTimer;
- Button1: TButton;
- Label1: TLabel;
- Label2: TLabel;
- result1: TLabel;
- result2: TLabel;
- SpinButton1: TSpinButton;
- Label3: TLabel;
- Label4: TLabel;
- procedure LMDHiTimer1Timer(Sender: TObject);
- procedure Timer1Timer(Sender: TObject);
- procedure Button1Click(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- procedure SpinButton1DownClick(Sender: TObject);
- procedure SpinButton1UpClick(Sender: TObject);
- private
- { Private-Deklarationen }
- public
- { Public-Deklarationen }
- end;
-
- var
- Form1: TForm1;
- j, k, endvalue:longint;
- start, start2:String;
-
- implementation
-
- {$R *.DFM}
-
- procedure TForm1.LMDHiTimer1Timer(Sender: TObject);
- begin
-
- if j=0 then start:=timetostr(now)
- else if j=endvalue then
- begin
- LMDHiTimer1.Enabled:=False;
- result1.caption:='I was hit '+inttostr(j)+' times.'+chr(13)+
- 'starttime: '+start+chr(13)+
- 'endtime:' + timetostr(now);;
- end;
- inc(j);
-
- end;
-
-
- procedure TForm1.Timer1Timer(Sender: TObject);
- begin
-
- if k=0 then start2:=timetostr(now)
- else if k=endvalue then
- begin
- timer1.Enabled:=False;
- result2.caption:='I was hit '+inttostr(k)+' times.'+chr(13)+
- 'starttime: '+start2+chr(13)+
- 'endtime:' + timetostr(now);
- spinbutton1.enabled:=true;
- button1.enabled:=true;
- Screen.cursor:=crDefault;
- end;
- inc(k);
-
- end;
-
- procedure TForm1.Button1Click(Sender: TObject);
- begin
-
- k:=0;j:=0;
- result1.caption:='';
- result2.caption:='';
- button1.enabled:=false;
- spinbutton1.enabled:=false;
- screen.cursor:=crHourglass;
- Timer1.enabled:=true;
- LMDHitimer1.enabled:=true;
-
- end;
-
- procedure TForm1.FormCreate(Sender: TObject);
- begin
-
- endvalue:=100;
- label4.caption:=inttostr(endvalue);
-
- end;
-
- procedure TForm1.SpinButton1DownClick(Sender: TObject);
- begin
-
- if endvalue=10 then exit;
- dec(endvalue,10);
- label4.caption:=inttostr(endvalue);
- end;
-
- procedure TForm1.SpinButton1UpClick(Sender: TObject);
- begin
-
- Inc(endvalue,10);
- label4.caption:=inttostr(endvalue);
-
- end;
-
- end.
-