if you need a vb6 (com) dll that has the ini file api already in it I have one that I wrote a long while ago for use in my vb6 programs that needed ini access.
or...
Option Explicit
'//Win32API - For I/O from INI files-----------------------------------------------
Private Declare Function GetPrivateProfileString Lib "kernel32" _
Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, _
ByVal lpKeyName As String, _
ByVal lpDefault As String, _
ByVal lpReturnedString As String, _
ByVal nSize As Long, _
ByVal lpFileName As String) As Long
Private Declare Function WritePrivateProfileString Lib "kernel32" _
Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, _
ByVal lpKeyName As String, _
ByVal lpString As String, _
ByVal lpFileName As String) As Long
Private Declare Function GetPrivateProfileSection Lib "kernel32" _
Alias "GetPrivateProfileSectionA" (ByVal lpAppName As String, _
ByVal lpReturnedString As String, _
ByVal nSize As Long, _
ByVal lpFileName As String) As Long
Private Declare Function WritePrivateProfileSection Lib "kernel32" _
Alias "WritePrivateProfileSectionA" (ByVal lpAppName As String, _
ByVal lpString As String, _
ByVal lpFileName As String) As Long
Public Function GetINILine(ByVal Section As String, _
ByVal KeyName As String, _
ByVal File) As String
'//Set Static data
Dim lngRet As Long
Dim Def, KeyVal As String
KeyVal = Space(255)
Def = "ERROR"
'//get INI value
lngRet = GetPrivateProfileString(Section, KeyName, Def, KeyVal, Len(KeyVal), File)
GetINILine = Left$(KeyVal, lngRet)
End Function
Public Sub PutINILine(ByVal Section As String, _
ByVal Key As String, _
ByVal Data As String, _
ByVal File As String)
WritePrivateProfileString Section, Key, Data, File
End Sub
Public Function GetINISection(ByVal Section As String, _
ByVal File As String) As String
'//Set Static data
Dim strRet As String * 20000
Dim lngRet, lngRetLength As Long
lngRetLength = Len(strRet)
'//get ini section
lngRet = GetPrivateProfileSection(Section, strRet, lngRetLength, File)
If lngRet > 0 Then
GetINISection = Left(strRet, lngRet - 1)
Else
GetINISection = vbNullString
End If
End Function
Public Sub PutINISection(ByVal Section As String, _
ByVal Data As String, _
ByVal File As String)
WritePrivateProfileSection Section, Data, File
End Sub
you could stick that in a module or a dll project and compile it
DBP_NETLIB_v1.4.3 - 65 FREE Functions * Click Logo