
VB3 - Reading & Writing Fron INI Files
Quote:
>Can someone please direct me to a source to get the very
>basics of reading from and writing to ini files? I have
>downloaded Ken Peterson's KPINI but without the basics it
>doesn't do me much good. I'd really appreciate a pointer or
>two.
>Thanks.
Hi
Here is a function which will help u get information from an INI file.
Pass this function the INI file name, the section name and the item
and it will return the string from the INI file.
The function is named sTOOLS_GetStringFromINI 'cause the function
returns a string (s) and is located in a common TOOLS.BAS file.
Function sTOOLS_GetStringFromINI (rsFileName As String, rsAppName As
String, rsKeyName As String) As String
On Error GoTo LogonBAS_GetStringFromIniErr
Dim sDefaults As String
Dim sReturnString As String
Dim nRetValue As Integer
Dim nSize As Integer
sTOOLS_GetStringFromINI = ""
sReturnString = Space(128)
nSize = Len(sReturnString)
sDefaults = ""
nRetValue = GetPrivateProfileString(rsAppName, rsKeyName,
sDefaults, sReturnString, nSize, rsFileName)
sTOOLS_GetStringFromINI = Left(sReturnString, nRetValue)
End Function