USUÁRIO:      SENHA:        SALVAR LOGIN ?    Adicione o VBWEB na sua lista de favoritos   Fale conosco 

 

  Dicas

  Visual Basic    (Arquivos/Diretórios)

Título da Dica:  Gravar e Ler em Arquivo INI
Postada em 17/2/2004 por ixeyc         
'****************** INICIO leitura e escrita em arquivo INI
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 Ret As String
Public Sub WriteINI(filename As String, Section As String, Key As String, Text As String)
    WritePrivateProfileString Section, Key, Text, filename
End Sub
Public Function ReadINI(filename As String, Section As String, Key As String)
    Ret = Space$(255)
    RetLen = GetPrivateProfileString(Section, Key, "", Ret, Len(Ret), filename)
    Ret = Left$(Ret, RetLen)
    ReadINI = Ret
End Function


pra gravar
WriteINI "c:\windows\conf.ini", "Impressora", "Impressora", textimpressora

pra ler
ReadINI("C:\Windows\conf.ini", "Impressora", "Impressora")
 


CyberWEB Network Ltda.    © Copyright 2000-2018   -   Todos os direitos reservados.
Powered by HostingZone - A melhor hospedagem para seu site
Topo da página