Solved

Working with ini files.

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

803 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