• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 284
  • Last Modified:

Working with ini files.

I have a weird one. I am using an ini file to hold the details of an aplication settings. For some reason the application does not use the ini file in the its path, but creates and uses one in the windows folder. Can I avoid this.
Code----------------------------------------------------------
procedure TPortSetupMain.ProcessSettings;
begin
portINI := TINIFile.Create(ExtractFilePath('datacollex1.exe') + 'callcollex.ini');
    portINI.WriteInteger('ComPortSet', 'Speed', LongInt(BaudValues[Bauds.ItemIndex]) * 10);
    portINI.WriteInteger('ComPortSet', 'Parity', Paritys.ItemIndex);
    portINI.WriteString('ComPortSet', 'Databits', IntToStr(8-Databits.ItemIndex));
    portINI.WriteString('ComPortSet', 'Stopbits', IntToStr(Succ(Stopbits.ItemIndex)));
portINI.Free;
------------------------------------------------------------
This maybe something to do with Windows XP!
   
0
lloydie-t
Asked:
lloydie-t
  • 2
1 Solution
 
esoftbgCommented:
procedure TPortSetupMain.ProcessSettings;
begin
  portINI := TINIFile.Create(ExtractFilePath(Application.ExeName) + 'callcollex.ini');
  portINI.WriteInteger('ComPortSet', 'Speed', LongInt(BaudValues[Bauds.ItemIndex]) * 10);
  portINI.WriteInteger('ComPortSet', 'Parity', Paritys.ItemIndex);
  portINI.WriteString('ComPortSet', 'Databits', IntToStr(8-Databits.ItemIndex));
  portINI.WriteString('ComPortSet', 'Stopbits', IntToStr(Succ(Stopbits.ItemIndex)));
portINI.Free;
0
 
lloydie-tAuthor Commented:
Thanks,
        I already had that info, but I thought it meant that I should replace it with a file name.
0
 
esoftbgCommented:
I understand your thought mistake well. Everybody can be wrong sometimes, don't worry about....
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now