Solved

Working with ini files.

Posted on 2004-04-30
3
278 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

696 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