ricordo di avere gia postato le 2 funzioni ma non ritrovo il 3d cmq
x leggere
per scriverecodice:Public Function ReadStringIni(ByVal sSection As String, ByVal sKeyName As String, ByVal sFileName As String) As String ' Legge una stringa da un file *.INI ' Input: sSection sezione ' sKeyName parola chiave ' sFileName file *.INI ' Output: stringa letta oppure "" se fallita lettura ' Dim nResult As Integer Dim sDefault As String Dim sReturnedString As String Dim nSize As Integer On Error GoTo ReadStringIniError sDefault = "" sReturnedString = SPACE$(255) nSize = 255 nResult = GetPrivateProfileString(sSection, sKeyName, sDefault, sReturnedString, nSize, sFileName) If nResult <> 0 Then ReadStringIni = Left$(sReturnedString, nResult) Else 'errore ReadStringIni = "" End If Exit Function ReadStringIniError: ReadStringIni = "" End Function
codice:Public Function WriteStringIni(ByVal sSection As String, ByVal sKeyName As String, ByVal sString As String, ByVal sFileName As String) As Integer ' ' Scrive una stringa in un file *.INI ' Input: sSection sezione ' sKeyName parola chiave ' sString stringa da scrivere ' sFileName file *.INI ' Output: False: fail; True: Ok ' Dim nResult As Integer nResult = WritePrivateProfileString(sSection, ByVal sKeyName, ByVal sString, sFileName) If nResult = 0 Then WriteStringIni = False Else WriteStringIni = True End If Exit Function WriteStringIniError: WriteStringIni = False Exit Function End Function

Rispondi quotando