• Creator
  • #4115

    Hi there,

    Are there any built-in routines in Formativ for working with ini-files?



  • Author
  • #7147
    Support 1


    Thank you for your enquiry.

    The means to manipulate INI files with Formativ depends on which version you’re using.

    With Formativ 1.6x, you will need to use the StringList object, which is documented under Utilities in the Language Guide. Here is a simple example:

        Dim iIsConnectOn
        Dim oStrings
        Set oStrings = Utilities.StringList
        If oStrings.LoadFromFile("C:WindowsMyConfig.INI") Then
          iIsConnectOn = (oStrings.Values("Connect") = "1")
          iIsConnectOn = False
        End If
        Set oStrings = Nothing

    To distinguish items which are in different INI sections but have the same name, you may need to use a secondary StringList. Use

        iIndex = oStrings.IndexOf("[My Section]")

    to find a specific INI section by name.

    Formativ 2.0 and later provides access to the TIniFile object. Here is a simple usage example:

        dim iIsConnectOn
        dim oIniFile
        set oIniFile = TIniFile.Create("C:WindowsMyConfig.INI")
        iIsConnectOn = oIniFile.ReadBool("HTTP Connection", "Connect", false)
        set oIniFile = nothing

    You can find documentation on TIniFile (along with the components on the Standard, Additional, Win32, System and Dialogs tabs of the Forms Designer component palette) in the Borland Delphi VCL help file. This can be downloaded from here.

    Note that you can use the FileSystemUtils object (Utilities.FileSystem) to help build the components of a filename path.

    I hope this information is helpful.

    Advansys Support

    [This message was edited by Support 3 on March 15, 2005 at 02:37 PM.]



    Support 1a

    You are welcome.

    Advansys Support

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.