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 FormActivate(Sender: TObject);
private
Zielzeit: TDateTime;
{ 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)) + '
einstellungen.ini';
ini := TIniFile.Create(filename);
Zielzeit := now + 1;
try
ini.WriteDateTime('
Daten','
Zielzeit',Zielzeit);
finally
ini.Free;
end;
Timer1.Enabled:=true;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Label1.Caption:= TimeToStr(zielzeit - now);
if now >= Zielzeit
then
begin
Showmessage('
Klappt');
Timer1.enabled:=false;
end;
end;
procedure TForm1.FormActivate(Sender: TObject);
var
ini: TIniFile;
filename:
String;
begin
filename := ExtractFilePath(ParamStr(0)) + '
einstellungen.ini';
ini := TIniFile.Create(filename);
Zielzeit:=StrtoDateTime(ini.ReadString('
Daten','
Zielzeit','
'));
end;
end.