Option Explicit
Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, 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
Public Function ini_Read(FP As String, AppName As String, KeyName As String) As String
Dim nSize As Long
nSize = 65535: ini_Read = String(nSize, vbNullChar)
nSize = GetPrivateProfileString(AppName, KeyName, ini_Read, ini_Read, nSize, FP)
If nSize > 0 Then
ini_Read = Left(ini_Read, nSize)
Else
ini_Read = ""
End If
End Function
Public Sub ini_Write(FP As String, AppName As String, KeyName As String, ValText As String)
WritePrivateProfileString AppName, KeyName, ValText, FP
End Sub
11-19