PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Elias Montoya on May 11, 2009, 07:40:35 PM

Title: INI Functions
Post by: Elias Montoya on May 11, 2009, 07:40:35 PM

I have never used the integrated INI functions, and now im trying to make them work.

When i use this:

FF_INI_SetKey(FileName, "MAIN", "PATH", FilePath)

I get an empty ini file. do i need to add the sections manually before adding items or something like that? If so, how?

Thanx in advance.
Title: Re: INI Functions
Post by: Elias Montoya on May 11, 2009, 08:03:47 PM
 Im guessing this features are for modifying already existing ini files, instead of create new ones?
Title: Re: INI Functions
Post by: Jean-Pierre LEROY on May 13, 2009, 06:20:02 AM
Hi Elias,

I use the integrated INI functions since my first FireFly program without any problem.

The only tip that I can give you is to precise the full filename for the ini file; to do that I compose the filename with the CurDir$ function; see the example below.

Hope it helps.


Local lINI As String : lINI = CurDir$+"\"+"PingMyIpAddresses.ini"                                         
FF_INI_SetKey(lINI, "General", "TimeOut", FF_TextBox_GetText (HWND_PINGMYIPADDRESSES_SECONDES))


Jean-Pierre
Title: Re: INI Functions
Post by: Marc Van Cauwenberghe on May 13, 2009, 11:14:28 AM
Hello,

This is what I always do. I always call my ini file the same as my exe file.


Local sIniFile As String
sIniFile = app.Path &  Left$(app.EXEName,Len(app.EXEName)-4) & ".ini"   
g_Vemado2009Ini.DbaseDir       = FF_INI_GetKey (sIniFile, "Folders", "Database"      , "Database")
Title: Re: INI Functions
Post by: Bern Ertl on May 13, 2009, 04:24:07 PM
Saving/writing INI files to the program or current directory is asking for trouble on Windows Vista (and possibly XP if tweaked for IT security).  Try using the CSIDL info to find a safe path no matter what operating system you are using:

http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2962
Title: Re: INI Functions
Post by: Elias Montoya on May 13, 2009, 08:55:14 PM

Its not working with me guys. Would you be so kind of posting a small example
of how to create an ini file and add a simple key?
Title: Re: INI Functions
Post by: Rudolf Fürstauer on May 14, 2009, 05:08:10 AM
Put this code in FORM1_WM_CREATE:

    Local IniFile       As String

    'create new INI-File
    IniFile = APP.Path & "myfile.ini"
    FF_INI_SetKey (IniFile, "PROGRAMM", "DATA", "12345") 

    'read the new INI-File
    If FF_INI_KeyExists(IniFile, "PROGRAMM", "DATA") Then
        MsgBox "The Key: " & FF_INI_GetKey (IniFile, "PROGRAMM", "DATA", "-") 
    Else
        MsgBox "Key's not existing"
    End If 



I hope this helps.

Rudolf Fürstauer
Title: Re: INI Functions
Post by: Elias Montoya on May 14, 2009, 06:45:58 PM

I was expecting that the setkey command created something like:

Keyname=

When the key contents were an empty string. :)


Thanx! This works like a charm. :)