• Within Windows NT4, Windows 2000 in fact even in Windows 95 & 98 (they also exist in dot net but for the life of me can not recall their namespace) there are available system modules which will read/write an INI file:

    In VB code would:

    Declare Function WritePrivateProfileString Lib "Kernel32" Alias "WritePrivateProfileStringA" (ByVal AppName$, ByVal KeyName$, ByVal keydefault$, ByVal FileName$) As Long

        Declare Function GetPrivateProfileString Lib "Kernel32" Alias "GetPrivateProfileStringA" (ByVal AppName$, ByVal KeyName$, ByVal keydefault$, ByVal ReturnString$, ByVal NumBytes As Long, ByVal FileName$) As Long

    In Use:

    Public Function ReadString(ptSectionName As String, ptKeyName _ As String, INI_FileName As String, txtDefault As String) As String

    Dim lCharacters as Long

    Dim tBuffer(256)

    tBuffer = String$(256, 0)

    lCharacters = GetPrivateProfileString(ptSectionName, ptKeyName, "", tBuffer, 255, INI_FileName)

    If lCharacters > 0 Then

            tIniString = Left$(tBuffer, lCharacters)

        Else

            'tIniString = ""

            tIniString = txtDefault     '10/17/02 RMJc

        End If

        ReadString = tIniString

    End Function

    Hope this Helps

     

     

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]