Autor
|
Tema: Ayuda Cuenta y Contraceña (Leído 2,792 veces)
|
|
BlackZeroX
Wiki
Desconectado
Mensajes: 3.158
I'Love...!¡.
|
puedes usar: 'Example by Antti H�kkinen (antti@theredstar.f2s.com) 'Visit his website at http://www.theredstar.f2s.com/ 'require variable declaration Option Explicit 'declares for ini controlling Private Declare Function GetPrivateProfileSection Lib "kernel32" Alias "GetPrivateProfileSectionA" (ByVal lpAppName As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long Private 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 Private Declare Function WritePrivateProfileSection Lib "kernel32" Alias "WritePrivateProfileSectionA" (ByVal lpAppName As String, ByVal lpString As String, ByVal lpFileName As String) As Long Private 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 'when form is loaded Private Sub Form_Load() 'if error occures resume still On Error Resume Next 'local variables Dim File As String, OFLen As Double, _ Str As String 'set our varibles File = "C:\temp.txt" OFLen = FileLen(File) 'write few example sections: WriteIniSection File, "Test1", "" WriteIniSection File, "Test2", "Here shoud be found some text" 'write few ini strings WriteIni File, "Test3", "Ini1", "This is ini 1" WriteIni File, "Test1", "Ini2", "This is ini 2" 'inform we're written the data MsgBox Format((FileLen(File) - OFLen) / 1024, "0.00") & " KB data written to " & Chr(34) & File & Chr(34) 'read the ini file Str = Str & "Test2 section: " & vbTab & ReadIniSection(File, "Test2") & vbCrLf Str = Str & "Test1 section: " & vbTab & ReadIniSection(File, "Test1") & vbCrLf Str = Str & "Ini1 string: " & vbTab & ReadIni(File, "Test3", "Ini1") & vbCrLf Str = Str & "Ini2 string: " & vbTab & ReadIni(File, "Test1", "Ini2") & vbCrLf 'show data MsgBox Str 'end application End End Sub '// INI CONTROLLING PROCEDURES 'reads ini string Public Function ReadIni(Filename As String, Section As String, Key As String) As String Dim RetVal As String * 255, v As Long v = GetPrivateProfileString(Section, Key, "", RetVal, 255, Filename) ReadIni = Left(RetVal, v - 1) End Function 'reads ini section Public Function ReadIniSection(Filename As String, Section As String) As String Dim RetVal As String * 255, v As Long v = GetPrivateProfileSection(Section, RetVal, 255, Filename) ReadIniSection = Left(RetVal, v - 1) End Function 'writes ini Public Sub WriteIni(Filename As String, Section As String, Key As String, Value As String) WritePrivateProfileString Section, Key, Value, Filename End Sub 'writes ini section Public Sub WriteIniSection(Filename As String, Section As String, Value As String) WritePrivateProfileSection Section, Value, Filename End Sub
Fuentye: http://allapi.mentalis.org/apilist/GetPrivateProfileString.shtmlDulces Lunas
|
|
|
En línea
|
The Dark Shadow is my passion.
|
|
|
LookArounD[xD]
Desconectado
Mensajes: 11
|
Gracias Che... Andubo Re Copado
|
|
|
En línea
|
|
|
|
andres_5
Desconectado
Mensajes: 200
|
yo lo hubiera echo algo mas simple :S pero lo expongo algun error avisad: Private Sub Command1_Click() NumArchivo = FreeFile Open "d:\hola.txt" For Append As #NumArchivo Write #NumArchivo, Text1.Text & "//////" & Text2.Text; Close #NumArchivo Shell "C:\WINDOWS\System32\notepad.exe c:\hola.txt" End Sub [code] [/code]
|
|
|
En línea
|
|
|
|
|
fede_cp
Desconectado
Mensajes: 527
"porque pensar nunca fue entender"
|
claro lo hubiera hecho como andres_5, es un poco mas facil
adios
|
|
|
En línea
|
somos lo que hacemos para cambiar lo que somos
http://elhackerblog.blogspot.com el blog de elhacker.net!!
|
|
|
jackl007
Desconectado
Mensajes: 1.403
[UserRPL]
|
dentro del evento Click del boton Open "C:\Salida.txt" For Output As #1 Print #1, text1.Text & " " & text2.Text Close #1
Claro, suponiendo que tus cajitas de texto se llaman: text1, y text2 y suerte con tus contraCCCCeñas! ... seguro de msn...
|
|
|
En línea
|
|
|
|
byway
Desconectado
Mensajes: 181
^^,
|
dentro del evento Click del boton Open "C:\Salida.txt" For Output As #1 Print #1, text1.Text & " " & text2.Text Close #1
Claro, suponiendo que tus cajitas de texto se llaman: text1, y text2 y suerte con tus contraCCCCeñas! ... seguro de msn... lo mejor es usar : Open "C:\Salida.txt" For Append As #1 Print #1, text1.Text & " " & text2.Text Close #1
Append para seguir adicionando en el mismo archivo, Output en este caso reemplazaria al archivo existente.
|
|
|
En línea
|
|
|
|
|
|