Save program settings ( file or registry ?)

Discussion in 'Questions (Windows Mobile)' started by TWELVE, May 11, 2008.


    TWELVE Active Member Licensed User


    i've got a question regarding how i can save my app's settings/preferences.

    I want so save my app/user settings to somewhere ( file, registry), so i can read them after program start to save the user from doing the settings all the time over and over.

    1. Do you need to save settings in your programs.. ?

    2. How do you do this..?

    2. has anyone a piece of code - or possibly a lib - ready that is handling the settings ( create/read/save)..?

    i personally tend not to use the registry, for certain reasons, but if one has already something similar in place, i could be persuaded :))


  2. klaus

    klaus Expert Licensed User

    Hello TWELVE,

    I save the values of the setting variables in a simple text file when leaving the program. And load this file at startup and set the settings.

    I do this in all my programs.
    You can have a look in the Wine Cellar Manager program.
    The routines are SaveInit and LoadInit where I save the Language index, last file used and the table column widths. But anyway there is really nothing special in there.

    You can also have a look in alfcen's B4ppctemplate.

    Best regards
  3. specci48

    specci48 Well-Known Member Licensed User


    TWELVE Active Member Licensed User

    This was also my plan.i looked into your code, the way you do this is just plain saving of the values.I thought about something like this here:

    COMPort = COM8
    Server = "a server"

    This is not that hard to program, but it is harder than it appears to be..:)

    Is some advanced string processing because you don't know where the equals are and the parameter name also could contain some spaces.

    Thx..i will have a look at this stuff.

    How does this work if you exit the program, where is the table being stored..?


  5. WZSun

    WZSun Member Licensed User

    Do take note that ""db2000 - INI" dll" is not compatible with the Beta 2.62 if compiled with optimised option enabled.. as it reported an error.. even when running from IDE mode.
  6. Cableguy

    Cableguy Expert Licensed User

    Since the Format of the parameters are setted BY YOU, then, you can use that to make sure the settings are "Original" and read the important lines and the trimm them so that only the needed info is kept...

    Here's an aboandoned project of mine, but in wich, a full basical ini file reading/wtng is implemented...

    Attached Files:

  7. specci48

    specci48 Well-Known Member Licensed User

    Before exiting the program I'll copy every data to be stored into the table. After that I'll just use SaveCSV to export the data to the current folder of the program. As the filename I'll use something like AppPath & "\MyProgram.cfg"


    TWELVE Active Member Licensed User

    Thx a lot..i will have a look into your code and see what's usuable for my project..!

    That's pretty nice and easy at the same time.I didn't take notice of the table.control because i didn't have a use for it.

    Since cableguy recommended to use the table.control for prefs file manipulation, this little table thingy appears to be very useful.

    The table.control solution is easy and done very quickly, but the resulting cfg file is not the style i was thinking of.

    I wrote now a routine, which removes all spaces at the start and end of each line and returns config key and it's value.That's working with an existing file from the windows version of my application, and this was what i was looking for primarily.

    Unfortunately now i've got some issues in saving the prefs file.I believed i could just replace a single line within the existing file, but that doesn't work that easy.I opened up a new thread for that, but answers to this were also welcomed here.


    Last edited: May 11, 2008
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice