Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 554461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:42:43+00:00 2026-05-13T11:42:43+00:00

Update: I’ve added the following code: function TSettingsForm.AppDataPath: string; //CSIDL_APPDATA Individual user Data //CSIDL_COMMON_APPDATA

  • 0

Update: I’ve added the following code:


function TSettingsForm.AppDataPath: string;
 //CSIDL_APPDATA  Individual user Data
//CSIDL_COMMON_APPDATA  Common to Computer Data
  // works so long as people have at least IE 4.  (and Win95 or better)
var
   r: Bool;
   path: array[0..Max_Path] of Char;
begin
   r := ShGetSpecialFolderPath(0, path, CSIDL_APPDATA, False) ;
   if r then result := path
   else result := '';
end;

And I’ve changed the setinifilename function (See below). It will not create the folder structure.

–End update–

I’m behind the times, on what to and not to do. This is how I am currently saving the settings for my software. I just tested it on Vista not logged in as an administrator, and it gives me an error message cannot write ini file. So I’m guessing I’m supposed to write the data to a data folder? I’ve never used vista/win7 before, and want this software to be windows 2K+ compatible. What should I do to save the settings. I also really didn’t want to mess with the registry, because every little bit you add to it, slows down the computer just that much more… (or so It seems)

Thanks for any input.



procedure TSettingsForm.setinifilename;
var filename:string;
    Path:string;
  begin
    filename:='key.ini';
    path:=AppDataPath+'\MyCompanyName\ProductName\';
    if NOT DirectoryExists(path) then
        CreateDir(path);
    inifilename:= path+filename;
  end;

procedure TSettingsForm.SaveSettings;
var
 appINI:  TIniFile;

begin
    appINI := TIniFile.Create(inifilename) ;
try
    low:= Trunc (edt_low.value);
    high:=Trunc (edt_high.value);
    appINI.WriteInteger('SPEED','LOW',low);
    appINI.WriteInteger('SPEED','HIGH',high);
    appINI.WriteString('PROXY','SERVER',edtProxyServer.Text);
    appINI.WriteString('PROXY','PORT',edtProxyPort.Text);
    appINI.WriteString('PROXY','USERNAME',edtProxyUserName.Text);
    appINI.WriteString('PROXY','PASSWORD',edtProxyPass.Text);

//    status.text:='Saved Data';
  finally
    appIni.Free;
  end;
end;
 procedure TSettingsForm.GetSettings;
Var
  appINI : TIniFile;
begin
  appINI := TIniFile.Create(inifilename) ;
  try
    //if no last user return an empty string
    edt_low.value:= appINI.ReadInteger('SPEED','LOW',0);
    edt_high.value:= appINI.ReadInteger('SPEED','HIGH',0);
    low:= Trunc (edt_low.Value);
    high := Trunc (edt_high.Value);

    edtProxyServer.Text:=appINI.ReadString('PROXY','SERVER','');
    edtProxyPort.Text:=appINI.ReadString('PROXY','PORT','0');
    edtProxyUserName.Text:=appINI.ReadString('PROXY','USERNAME','');
    edtProxyPass.Text:= appINI.ReadString('PROXY','PASSWORD','');
  finally
    appINI.Free;
  end;
 end;

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:42:43+00:00Added an answer on May 13, 2026 at 11:42 am

    In Vista, your program is NOT allowed to write to the program files directory where your program is located.

    You now have to save your ini files in the AppData directory.

    A description of how to do this in delphi is at:
    http://www.theabsolute.net/sware/delphivista.html#datafolder

    And to be Vista/Windows 7 compatible, the rest of that web page will be a good guideline.


    For your update, you cannot CreateDir more than 1 level deep at once. Use the ForceDirectories function instead:

        path:=AppDataPath+'\MyCompanyName\ProductName\'; 
        if NOT DirectoryExists(path) then
          ForceDirectories(path);
    

    p.s. Don’t be afraid to write program settings to the Registry. That’s what the registry is for. In fact, it properly handles settings for different users for you when different users are logged in. The Registry works in the same way in 98/Vista/7. Whereas ini files have actually been depreciated, and are no longer used by Windows.

    You say you don’t want to mess with the registry because “every little bit you add to it, slows down the computer just that much more”. Actually that is NOT true. The registry is simply a database. And if it is 10 MB or 100 MB, the difference in time it takes to access is imperceptable.

    It’s all those companies selling Registry Cleaner programs that are trying to keep this fairy tale going. Using their cleaners can do you more harm than good. All they need to do is wipe out one or two important entries and you can be in deep doo-doo. Please read this article about Registry Cleaners, and especially the “Marginal performance benefit” section which explains correctly that the problems Windows 98 and earlier had with the Registry have been mostly fixed.

    If your program adds more than 2 or 3 KB to the Registry, that will be a lot, and it is an insignificant amount. Use the registry. Do it right.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

UPDATE: I added this to my unload function: $(window).resize(function(){ var pageheight = $(window).height(); $('section').css('height',
Update : Properly initialising string with char string[sizeof buffer - 1] has solved the
UPDATE: Sorry, forgot to include some of the code (face-palm). I included it in
Update: It's not really necessary to remove added scripts considering once they run you
Update: Solved, with code I got it working, see my answer below for the
Update: It is solved .. For some reason, the data is not getting inserted
UPDATE: Turns out my code works. Browser was caching previous failed response. Thanks for
** Update ** Modified the code for Ricardo Lohmann's suggestion with the additional modification
UPDATE: Seems like an issue of wkhtmltopdf not exiting properly I'm doing the following
Update: Is there a way to achieve what I'm trying to do in an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.