unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
Button1: TButton;
procedure Timer1Timer(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Timer1Timer(Sender: TObject);
var
str:string;
filename:textfile;
begin
str:=changefileext(application.exename,'.txt');
assignfile(filename,str);
if fileexists(str) then
append(filename)
else
rewrite(filename);
writeln(filename,datetimetostr(now));
closefile(filename);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Timer1.Enabled:=true;
end;
end.