INI Functions

Started by Elias Montoya, May 11, 2009, 07:40:35 PM

Previous topic - Next topic

Elias Montoya


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.

Elias Montoya

 Im guessing this features are for modifying already existing ini files, instead of create new ones?

Jean-Pierre LEROY

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

Marc Van Cauwenberghe

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")

Bern Ertl

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

Elias Montoya


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?

Rudolf Fürstauer

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

Elias Montoya


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. :)