Re: reading/writing to ini files



Public 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 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
Public Sub writeINI(filename As String, heading As String, entry As
String, value As String)

Call WritePrivateProfileString(heading, entry, value, filename)

End Sub

Public Function readINI(filename As String, heading As String, entry As
String)

Dim ret As String, NC As Long

ret = String(255, 0)

NC = GetPrivateProfileString(heading, entry, "NULL", ret, 255,
filename)

If NC <> 0 Then ret = Left$(ret, NC)

readINI = ret

End Function




I have that... it doesn't seem to work

.



Relevant Pages

  • Re: Typen unvertraeglich
    ... Private Declare Function WritePrivateProfileString Lib "kernel32" Alias ... "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ... lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As ...
    (microsoft.public.de.vb)
  • Re: Relative path to absolute
    ... The GetFullPathName API handles relative paths ... Private Declare Function GetFullPathName Lib "kernel32" Alias ... "GetFullPathNameA" (ByVal lpFileName As String, ByVal nBufferLength As Long, ...
    (microsoft.public.vb.general.discussion)
  • Re: Writing to a file using API
    ... I need is that they're copying data from one file to a new file. ... > (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal ... > CloseHandle hOrgFile ...
    (microsoft.public.vb.winapi)
  • Excel application opening from VB problem
    ... I am using VB6 and Excel 2000 in my project. ... "GetFullPathNameA" (ByVal lpFileName As String, ByVal nBufferLength As Long, ... Dim strFilePart As String ...
    (microsoft.public.vb.winapi)
  • Re: API to find the location of a program
    ... Private Declare Function GetFullPathName Lib "kernel32" Alias ... "GetFullPathNameA" (ByVal lpFileName As String, ByVal nBufferLength As Long, ... Dim Buffer As String, Ret As Long ...
    (microsoft.public.vb.winapi)