unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IniFiles, ExtCtrls, StdCtrls;
type
TForm1 =
class(TForm)
Button1: TButton;
Label1: TLabel;
Timer1: TTimer;
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FormPaint(Sender: TObject);
private
Zielzeit: TTime;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
ini: TIniFile;
filename:
String;
begin
filename := ExtractFilePath(ParamStr(0)) + '
zeit.ini';
ini := TIniFile.Create(filename);
Zielzeit := now + 1;
try
ini.WriteTime('
Daten','
Zielzeit',Zielzeit);
finally
ini.Free;
end;
Timer1.Enabled:=true;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
ini: TIniFile;
filename:
String;
begin
filename := ExtractFilePath(ParamStr(0)) + '
zeit.ini';
ini := TIniFile.Create(filename);
Label1.Caption:= TimeToStr(zielzeit - now);
if now >= Zielzeit
then
begin
Timer1.enabled:=false;
end;
end;
procedure TForm1.FormPaint(Sender: TObject);
var
ini: TIniFile;
filename:
String;
begin
filename := ExtractFilePath(ParamStr(0)) + '
zeit.ini';
ini := TIniFile.Create(filename);
try
if
ini.ReadDateTime('
Daten','
Zielzeit',Zielzeit) < now
then
finally
ini.Free;
begin
timer1.Enabled:=true;
end;
end;
end;
end.