Solved

Working with ini files.

Posted on 2004-04-30
3
279 Views
Last Modified: 2010-04-05
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
Comment
Question by:lloydie-t
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
esoftbg earned 125 total points
ID: 10965524
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
 

Author Comment

by:lloydie-t
ID: 10966488
Thanks,
        I already had that info, but I thought it meant that I should replace it with a file name.
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 10973465
I understand your thought mistake well. Everybody can be wrong sometimes, don't worry about....
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question