O con el mismo resultado y más simple:
Código Delphi
[-]
implementation
const
RTA_ARCH = 'C:\DBA\contar.txt';
var
ContadorDeEnter: Integer;
TS: TStrings;
procedure TForm1.FormCreate(Sender: TObject);
var
s: string;
begin
KeyPreview:= True;
TS:= TStringList.Create;
TS.LoadFromFile(RTA_ARCH);
ContadorDeEnter:= StrToInt(TS[TS.Count-1]);
StaticText1.AutoSize:= False;
StaticText1.Caption:= TS[TS.Count-1];
StaticText1.BevelKind:= bkTile;
end;
procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Inc(ContadorDeEnter);
StaticText1.Caption:= IntToStr(ContadorDeEnter);
TS.Add(StaticText1.Caption);
end;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
TS.SaveToFile(RTA_ARCH);
TS.Free
end;
Saludos.