Registriert seit: 28. Apr 2008
1.717 Beiträge
FreePascal / Lazarus
|
Re: In .ini ohne Adminrechte speichern?
26. Mär 2009, 21:32
Etwa so?
Delphi-Quellcode:
function GetSpecialFolder(Folder: Integer): String;
begin
SetLength(Result,MAX_PATH);
If SHGetSpecialFolderPath(0, PChar(Result), Folder, false)
then SetLength(Result,StrLen(PChar(Result)))
else Result:='';
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
var ini: TIniFile;
dir: String;
begin
Ini := TIniFile.Create(GetSpecialFolder(dir) + 'config.ini');
try
Ini.WriteInteger('Default', 'Channel', ComboBox1.ItemIndex);
Ini.WriteInteger('Default', 'Volume', TrackBar1.Position);
Ini.WriteBool('Default', 'Proxy', cbDirectConnection.Checked);
Ini.WriteString('Default', 'ProxyIP', ed_ProxyServer.Text);
finally
Ini.Free;
end;
Action:=caFree;
end;
end;
|
|
Zitat
|