Har problem med GetPrivateProfileSection, den läser bara första värdet i en sektion istället för alla... På denna sida står det om .ini filer.Problem med GetPrivateProfileSection
Nån som vet hur man ska göra eller har ett bra exempel?
//MrTSv: Problem med GetPrivateProfileSection
http://www.vbexplorer.com/VBExplorer/focus/ini_tutorial.asp
Jag hittade ett Ex. här.
http://www.aboutvb.de/khw/artikel/khwini.htm
Private Declare Function GetPrivateProfileSection Lib "kernel32" _
Alias "GetPrivateProfileSectionA" (ByVal Section As String, _
ByVal Buffer As String, ByVal Size As Long, _
ByVal FileName As String) As Long
Public Function GetAllSettings(AppName As String, Section As String, _
Optional ByVal FromIniFile As Boolean) As Variant
Dim nBuffer As String
Dim nRet As Long
Dim nItems() As String
Dim nItem() As String
Dim l As Long
Dim nSettings As Variant
Const kBufferSize = 32767
If FromIniFile Then
nBuffer = Space$(kBufferSize)
nRet = _
GetPrivateProfileSection(Section, nBuffer, kBufferSize, AppName)
nItems = Split(Left$(nBuffer, nRet), Chr$(0))
If Len(nItems(UBound(nItems))) Then
ReDim nSettings(0 To UBound(nItems), 0 To 1)
Else
ReDim nSettings(0 To UBound(nItems) - 1, 0 To 1)
End If
For l = 0 To UBound(nSettings)
nItem = Split(nItems(l), "=")
nSettings(l, 0) = nItem(0)
nSettings(l, 1) = nItem(1)
Next 'l
GetAllSettings = nSettings
Else
GetAllSettings = VBA.GetAllSettings(AppName, Section)
End If
End Function
/Mvh Sven-Olof