Attribute VB_Name = "iniparser" 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 Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long Public RecentFiles As New Collection Public Function buildRecents() Dim strval, filepath filepath = App.path & "/LM.ini" For i = 1 To 5 lastfile = ReadINI("Recent", "#" & i, filepath) RecentFiles.Add lastfile Next End Function Public Function ReadINI(tag, key, FileName) As String Dim strval As String * 255, strlen As Long strlen = GetPrivateProfileString(tag, key, "", strval, Len(strval), FileName) ReadINI = Left(strval, strlen) End Function Public Function WriteINI(tag, key, val, FileName) WritePrivateProfileString tag, CStr(key), CStr(val), FileName End Function Public Function addToRecent(FileName) 'Rebuild the array 'check if file exists in list Dim FileExists As Boolean FileExists = False For i = 1 To 5 If FileName = RecentFiles(i) Then RecentFiles.Remove i Exit For End If Next RecentFiles.Add FileName, , 1 'write array to file For i = 1 To 5 WriteINI "Recent", "#" & i, RecentFiles(i), App.path & "/LM.ini" Next End Function Public Function setdefaultlanguage(lngname) iniparser.WriteINI "Settings", "default_language", lngname, App.path & "/LM.ini" End Function