你要在uses 单元内添加 IniFiles,
procedure TForm1.FormActivate(Sender: TObject);
var
MyIniFile: TIniFile;
begin
MyIniFile := TIniFile.Create('myapp.ini');
with MyIniFile do
begin
Caption := ReadString('FormOptions', 'Caption', 'Main');
end;
MyIniFile.Free;
end;