• Creator
    Topic
  • #4115
    Anonymous

      Hi there,

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

      Regards,

      Peter.

    • Author
      Replies
    • #7147
      Support 1
      Participant

        Peter,

        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")
            Else
              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.]

        #7149
        Anonymous

          Thanks!!

          #7148
          Support 1a
          Participant

            You are welcome.

            Advansys Support

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