Quote:
|
Originariamente inviato da leadergl
Si...
Codice:
' -----------------------------------------------------------------
'Funzioni per la Gestione dei Files .INI delle Impostazioni
' -----------------------------------------------------------------
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
Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName 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 Function INIRead(File As String, Section As String, Item As String) As String
Dim sBuf As String
Dim iRC As Integer
sBuf = Space(1023) 'Leggi stringhe di 1024 caratteri
iRC = GetPrivateProfileString(Section, Item, "Not Found", sBuf, 1023, App.Path + "/" + File)
sBuf = Left$(sBuf, iRC)
If StrComp(sBuf, "Not Found") = 0 Then
INIRead = vbNullString
Else
INIRead = sBuf
End If
End Function
Public Sub INIWrite(File As String, Section As String, Item As String, ItemValue As String)
WritePrivateProfileString Section, Item, ItemValue, App.Path + "/" + File
End Sub
|
Fichissimo !!!!!!!
Beh molto bello .. solo dovrei un attimo capirci sulla questione sezioni, item ecc ....
Se ricordo bene la sezione comincia con parentesi quadre vero ????
Ad esempio sezione "percorsi" nell'ini diventa :
[percorsi]
e l'item sarā :
directory_incoming = c:\incoming
vero ?