unit SpecialFrm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IniFiles;
type
TSpecialForm =
class(TForm)
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
procedure FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
ini: TMemIniFile;
public
end;
var
SpecialForm: TSpecialForm;
implementation
{$R *.dfm}
const
Password = '
hallo';
procedure TSpecialForm.Button1Click(Sender: TObject);
begin
if Edit1.Text = Password
then
begin
ini.WriteString('
Abschnitt', '
Eintrag', Edit1.Text);
ini.UpdateFile;
ModalResult := mrOK;
end else ShowMessage(Password);
end;
procedure TSpecialForm.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
if Edit1.Text = Password
then ModalResult := mrOK
else ModalResult := mrCancel;
end;
procedure TSpecialForm.FormCreate(Sender: TObject);
var
fn: TFileName;
begin
fn := ChangeFileExt(ParamStr(0), '
.ini');
ini := TMemIniFile.Create(fn);
Edit1.Text := ini.ReadString('
Abschnitt', '
Eintrag', '
');
Button1Click(
nil);
end;
procedure TSpecialForm.FormDestroy(Sender: TObject);
begin
ini.Free;
end;
end.