I have only one section in my INI file below, but you can have many many sections in the INI file and even utilize multiple INI files. This example only has one INI file and one section, but I think you will get the idea. This is one way of doing things, which has worked for me.
contents of example.ini file located in C:\Program Files\cognos\cer3
[Strings]
String1="Hello "
String2="World"
String3="!"
example.mac:
Declare Function INIValue(INIFile as string, INIApp as string, INIKey as string) as string
Declare Function apiGetPrivateProfileString lib "kernel32" _
Alias "GetPrivateProfileStringA" _
(ByVal lpApplicationName As String, _
ByVal lpKeyName As String, _
ByVal lpDefault As String, _
ByVal lpReturnedString As String, _
ByVal nSize As Integer, _
ByVal lpFileName As String) as long
Option Explicit
Global gs_INILocation as String
Sub Main
Dim ls_String1 as String
Dim ls_String2 as String
Dim ls_String3 as String
gs_INILocation = "C:\Program Files\Cognos\cer3\example.ini"
ls_String1 = INIValue(gs_INILocation, "Strings", "String1")
ls_String2 = INIValue(gs_INILocation, "Strings", "String2")
ls_String3 = INIValue(gs_INILocation, "Strings", "String3")
msgbox(ls_String1 & ls_String2 & ls_String3)
End Sub
Function INIValue (INIFile as string, INIApp as string, INIKey as string) as string
dim INIBuffer as string*255
dim INIValueLength%
INIBuffer = ""
INIValueLength% = apiGetPrivateProfileString(INIApp, INIKey, " ", INIBuffer, 255, INIFile)
INIValue = Left$(INIBuffer,INIValueLength%)
End Function