12/03/2010, 15:52
|
| | Fecha de Ingreso: marzo-2010
Mensajes: 10
Antigüedad: 14 años, 9 meses Puntos: 0 | |
Respuesta: Programa para votaciones Cita: 1.
#If Win32 Then
2.
'Declaraciones para 32 bits
3.
Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" _
4.
(ByVal lpApplicationName As String, ByVal lpKeyName As Any, _
5.
ByVal lpDefault As String, ByVal lpReturnedString As String, _
6.
ByVal nSize As Long, ByVal lpFileName As String) As Long
7.
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" _
8.
(ByVal lpApplicationName As String, ByVal lpKeyName As Any, _
9.
ByVal lpString As Any, ByVal lpFileName As String) As Long
10.
#Else
11.
'Declaraciones para 16 bits
12.
Private Declare Function GetPrivateProfileString Lib "Kernel" _
13.
(ByVal lpApplicationName As String, ByVal lpKeyName As Any, _
14.
ByVal lpDefault As String, ByVal lpReturnedString As String, _
15.
ByVal nSize As Integer, ByVal lpFileName As String) As Integer
16.
Private Declare Function WritePrivateProfileString Lib "Kernel" _
17.
(ByVal lpApplicationName As String, ByVal lpKeyName As Any, _
18.
ByVal lpString As Any, ByVal lplFileName As String) As Integer
19.
#End If
20.
21.
Sub GuardarIni(FicheroINI As String, Seccion As String, _
22.
Clave As String, Valor As String)
23.
On Local Error GoTo ErrorGuardarIni
24.
WritePrivateProfileString Seccion, Clave, Valor, FicheroINI
25.
Exit Sub
26.
ErrorGuardarIni:
27.
MsgBox Err.Number & ". " & Err.Description
28.
Err.Clear
29.
End Sub
30.
31.
'------------------------------------
32.
33.
Function LeerIni(FicheroINI As String, Seccion As String, _
34.
Clave As String, Optional ValorDefault) As String
35.
Dim lpString As String
36.
Dim LTmp As Long
37.
Dim sRetVal As String
38.
On Local Error GoTo ErrorLeerIni
39.
If IsMissing(ValorDefault) Then
40.
lpString = ""
41.
Else
42.
lpString = ValorDefault
43.
End If
44.
sRetVal = String$(255, 0)
45.
LTmp = GetPrivateProfileString(Seccion, Clave, _
46.
lpString, sRetVal, Len(sRetVal), FicheroINI)
47.
If LTmp = 0 Then
48.
LeerIni = lpString
49.
Else
50.
LeerIni = Left(sRetVal, LTmp)
51.
End If
52.
Exit Function
53.
ErrorLeerIni:
54.
MsgBox Err.Number & ". " & Err.Description
55.
Err.Clear
56.
End Function Es ese? al ponerlo en un modulo me dice lo siguiente: Se esperába: numero de linea o etiqueta.
Si me podes ayudar xD |