10/02/2010, 13:31
|
| | Fecha de Ingreso: mayo-2009
Mensajes: 238
Antigüedad: 15 años, 6 meses Puntos: 7 | |
Respuesta: Guardar configuracion de app... Aqui dejo otro codigo haber si les sirve.
En un modulo bas
Código:
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 Sub GrabaINI(Archivo As String, Seccion As String, Clave As String, Text As String)
WritePrivateProfileString Seccion, Clave, Text, Archivo
End Sub
Public Function LeeINI(Archivo As String, Seccion As String, Clave As String)
Dim iRetLen As Integer
Dim sRet As String
sRet = Space(255)
iRetLen = GetPrivateProfileString(Seccion, Clave, "", sRet, Len(sRet), Archivo)
sRet = Left(sRet, iRetLen)
LeeINI = sRet
End Function
Para utilizarlo en cualquier form
Código:
Dim xRuta As String
Private Sub Form_Load()
xRuta = App.Path & "\archivo.ini"
End Sub
Private Sub Command1_Click()
Text1 = LeeINI(xRuta, "datos", "nombre")
Text2 = LeeINI(xRuta, "datos", "apellido")
End Sub
Private Sub Command2_Click()
Call GrabaINI(xRuta, "datos", "nombre", "tu nombre")
Call GrabaINI(xRuta, "datos", "apellido", "tu apellido")
End Sub
|