' Вот держи модуль, он могет все секции тебе выдать и все эллементы в секции. ' Может поможет, если ты об этом... Option Explicit '******************************************************************** '* Написано в 2002 году (Team HomeWork) * '* e-mail: sne_pro@mail.ru * '******************************************************************** Private Declare Function GetPrivateProfileSection Lib "kernel32" Alias "GetPrivateProfileSectionA" (ByVal strSection As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long Private Declare Function GetPrivateProfileSectionNames Lib "kernel32.dll" Alias "GetPrivateProfileSectionNamesA" (ByVal lpszReturnBuffer As String, ByVal nSize As Long, ByVal lpFileName As String) As Long Private Declare Function WritePrivateProfileSection Lib "kernel32" Alias "WritePrivateProfileSectionA" (ByVal strSection As String, ByVal lpString As String, ByVal lpFileName As String) As Long Private Declare Function GetProfStr Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal strSection As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long Public Declare Function SetINI Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal strSection As String, ByVal lpKeyName As String, ByVal lpString As String, ByVal lpFileName As String) As Long
Private Declare Function WPPStrToDelKey Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal strSection As String, ByVal lpKeyName As String, ByVal lpString As Long, ByVal lplFileName As String) As Long Private Declare Function WPPSToDelSec Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal strSection As String, ByVal lpKeyName As Long, ByVal lpString As Long, ByVal lplFileName As String) As Long
' Получение значения ключа Public Function GetINI(ByVal strSection As String, _ ByVal strKey As String, _ ByVal strDefault As String) As String
Dim slength As Long: GetINI = Space(512) slength = GetProfStr(strSection, strKey, strDefault, GetINI, 512, StData.sIniPath) GetINI = Left(GetINI, slength) End Function
Public Function GetINIEx(ByVal strSection As String, _ ByVal strKey As String, _ ByVal strDefault As String, _ ByVal sFileName As String) As String
Public Function GetINIEx(ByVal strSection As String, _ ByVal strKey As String, _ ByVal strDefault As String, _ ByVal sFileName As String) As String
Dim slength As Long: GetINIEx = Space(512) slength = GetProfStr(strSection, strKey, strDefault, GetINIEx, &H200, sFileName) GetINIEx = Left(GetINIEx, slength) End Function
' Получение всех ключей и их значений, зная секцию Public Function GetSecValues(ByVal sSection As String, _ ByRef outArray() As String, _ ByVal sFileName As String) As Long
Dim sBuffer As String: sBuffer = String$(&H4000, &H0) GetSecValues = GetPrivateProfileSectiOn(sSection, sBuffer, &H4000, sFileName)
If Not GetSecValues > 1& Then GetSecValues = &HFFFF: Exit Function
sBuffer = Left$(sBuffer, GetSecValues - 1&) outArray = Split(sBuffer, vbNullChar) GetSecValues = UBound(outArray) End Function
' Запись ключей и их значений в секции Public Sub SetSecValues(ByVal sSection As String, _ ByRef inArray() As String, _ ByVal sFileName As String)
Call WritePrivateProfileSectiOn(sSection, ByVal Join(inArray, vbNullChar), sFileName) End Sub
' Создание секции Public Sub SetSectiOn(ByVal sSection As String, _ ByVal sFileName As String)
Call WritePrivateProfileSectiOn(sSection, " ", sFileName) End Sub
' Получение имен всех секций Public Function GetSections(ByRef outArray() As String, _ ByVal sFileName As String) As Long
Dim sBuffer As String: sBuffer = String$(&H400, &H0) GetSections = GetPrivateProfileSectionNames(sBuffer, &H400, sFileName)
If Not GetSections > 1& Then GetSections = &HFFFF: Exit Function
sBuffer = Left$(sBuffer, GetSections - 1&) outArray = Split(sBuffer, vbNullChar) GetSections = UBound(outArray) End Function
' Удаление ключа Public Sub DelSecKey(ByVal sSection As String, _ ByVal sKey As String, _ ByVal sFileName As String)
Call WPPStrToDelKey(sSection, sKey, 0&, sFileName) End Sub
' Удаление секции (полностью) Public Sub DelSectiOn(ByVal sSection As String, _ ByVal sFileName As String)
Call WPPSToDelSec(sSection, 0&, 0&, sFileName) End Sub
Sorry, не заметил, а вобще колекции немного медленней чем массивы, так что можно еще InStr искать vbCrLf & "[" или vbCrLf & "]", а потом циклом загонять все в динамический массив...
А про гифы, если их не много, то в память, иначе делаем выбор меж скоростью и объемом занимаемой памяти...