Es sencillo, incluso si buscas en la ayuda de delphi encontrarás ejemplos; De todas formas aquí te adjunto un pequeño código que puedes probar en un form, que lo que hace es guardar (en el close) y restaurar el estado (en el crete) de un form en un fichero INI utilizzando la clase TIniFile.
Código Delphi
[-]
procedure TForm1.FormCreate(Sender: TObject);
var
Status: Integer;
begin
IniFile := TIniFile.Create (ChangeFileExt (
Application.ExeName, '.ini'));
Status := IniFile.ReadInteger ('MainForm', 'Status', 0);
if Status <> 0 then
begin
[Lee del fichero las posiciones usando valor por defecto]
Top := IniFile.ReadInteger ('MainForm', 'Top', Top);
Left := IniFile.ReadInteger ('MainForm', 'Left', Left);
Width := IniFile.ReadInteger ('MainForm', 'Width', Width);
Height := IniFile.ReadInteger ('MainForm', 'Height', Height);
case Status of
2: WindowState := wsMinimized;
3: WindowState := wsMaximized;
end;
end;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
var
Status: Integer;
begin
if MessageDlg ('Grabar el estado actual del formulario?',
mtConfirmation, [mbYes, mbNo], 0) = IdYes then
begin
Status := 1; case WindowState of
wsNormal: begin
IniFile.WriteInteger ('MainForm', 'Top', Top);
IniFile.WriteInteger ('MainForm', 'Left', Left);
IniFile.WriteInteger ('MainForm', 'Width', Width);
IniFile.WriteInteger ('MainForm', 'Height', Height);
end;
wsMinimized: Status := 2;
wsMaximized: Status := 3;
end;
if not Active then
Status := 2;
IniFile.WriteInteger ('MainForm', 'Status', Status);
end;
IniFile.Free;
end;