INI Read and INI Write Simple and Error Free
INI Read and INI Write made simple. I included examples in each function. If you like my codes, then please vote for me. But only if you like them. Thanks =)
API Declarations
'INI Read and Write
Declare Function GetPrivateProfileString Lib "kernel32" _
Alias "GetPrivateProfileStringA" (ByVal lpApplicationName _
As String, lpKeyName As Any, ByVal lpDefault As String, _
ByVal lpRetunedString As String, ByVal nSize As Long, _
ByVal lpFilename As String) As Long
Declare Function WritePrivateProfileString Lib "kernel32" _
Alias "WritePrivateProfileStringA" (ByVal lpApplicationName _
As String, ByVal lpKeyName As Any, ByVal lpString As Any, _
ByVal lplFileName As String) As Long
Rate INI Read and INI Write Simple and Error Free
(6(6 Vote))
Public Function INIRead(iAppName As String, iKeyName As String, iFileName As String) As String
'Example:
'x = INIRead("boot", "shell", "C:\WINDOWS\system.ini")
Dim iStr As String
iStr = String(255, Chr(0))
INIRead = Left(iStr, GetPrivateProfileString(iAppName, ByVal iKeyName, "", iStr, Len(iStr), iFileName))
End Function
Public Function INIWrite(iAppName As String, iKeyName As String, iKeyString As String, iFileName As String)
'Example:
'x = INIWrite("boot", "shell", "Explorer.exe", "C:\WINDOWS\system.ini")
r% = WritePrivateProfileString(iAppName, iKeyName, iKeyString, iFileName)
End Function
INI Read and INI Write Simple and Error Free Comments
No comments yet — be the first to post one!
Post a Comment