Zitat von
Heffalump:
Also ich würde das ganze nicht ganz so kompliziert machen. ...
Wenn es doch "kompliziert" sein soll
Delphi-Quellcode:
private
myWindowState: TWindowState;
procedure OnMinimize(Sender: TObject);
procedure OnRestore(Sender: TObject);
public
{ Public-Deklarationen }
end;
var
DemoForm: TDemoForm;
implementation
{$R *.dfm}
uses
IniFiles;
procedure TDemoForm.FormCreate(Sender: TObject);
var
ini: TIniFile;
begin
Application.OnMinimize := OnMinimize;
Application.OnRestore := OnRestore;
ini := TIniFile.Create('c:\test.ini');
try
myWindowState := TWindowState(ini.ReadInteger('system', 'windowstate', 0));
finally
ini.Free;
end;
self.WindowState := myWindowState;
end;
procedure TDemoForm.FormDestroy(Sender: TObject);
var
ini: TIniFile;
begin
ini := TIniFile.Create('c:\test.ini');
try
ini.WriteInteger('system', 'windowstate', Ord(myWindowState));
finally
ini.Free;
end;
end;
procedure TDemoForm.OnMinimize(Sender: TObject);
begin
myWindowState := wsMinimized;
end;
procedure TDemoForm.OnRestore(Sender: TObject);
begin
myWindowState := wsNormal;
end;
Stephan B.