нажимаю кнопку сохранить настройки и всё. файл появляется на диске С под названием SaveOptionsPort.ini. При загрузке программы настройки автоматически восстанавливаются, если файл SaveOptionsPort.ini есть на диске С. А смотрел здесь
библиотека inifiles подключена во-второй форме(настройки). Там весь код связанный с созданием ini файлаДобавлено (13.03.2010, 11:50)
---------------------------------------------
Code
//******Процедуры******
procedure TOptionsPorts.ReadParams;
begin
IniFile:=TIniFile.Create('C:\SaveOptionsPort.ini'); // создаем переменную
ComboBox1.ItemIndex:=IniFile.ReadInteger('OptionsPorts','ComboBox1ItemIndex',ComboBox1.ItemIndex); // выбранный пункт
ComboBox2.ItemIndex:=IniFile.ReadInteger('OptionsPorts','ComboBox2ItemIndex',ComboBox2.ItemIndex); // выбранный пункт
ComboBox3.ItemIndex:=IniFile.ReadInteger('OptionsPorts','ComboBox3ItemIndex',ComboBox3.ItemIndex); // выбранный пункт
ComboBox4.ItemIndex:=IniFile.ReadInteger('OptionsPorts','ComboBox4ItemIndex',ComboBox4.ItemIndex); // выбранный пункт
ComboBox5.ItemIndex:=IniFile.ReadInteger('OptionsPorts','ComboBox5ItemIndex',ComboBox5.ItemIndex); // выбранный пункт
IniFile.Free; // если сами создаем, то сами уничтожаем.
end;
procedure TOptionsPorts.WriteParams;
begin
IniFile:=TIniFile.Create('C:\SaveOptionsPort.ini');
IniFile.WriteInteger('OptionsPorts','ComboBox1ItemIndex',ComboBox1.ItemIndex);
IniFile.WriteInteger('OptionsPorts','ComboBox2ItemIndex',ComboBox2.ItemIndex);
IniFile.WriteInteger('OptionsPorts','ComboBox3ItemIndex',ComboBox3.ItemIndex);
IniFile.WriteInteger('OptionsPorts','ComboBox4ItemIndex',ComboBox4.ItemIndex);
IniFile.WriteInteger('OptionsPorts','ComboBox5ItemIndex',ComboBox5.ItemIndex);
IniFile.Free;
end;