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 LongPublic Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As LongPublic Function g_GetIniString(ByVal f_strKey As String, _ ByVal f_strSubKey As String, _ ByVal f_strIniFileName As String) As StringOn Error GoTo ErrExit
Dim strTemp As String * 144 Dim nRetCode As Long Dim strWinDir As String 'the following series of the API function call "GetPrivateProfileString" 'retrieves info from the user's .ini file ---this file originally 'had its values set by the setup program for that module nRetCode = GetPrivateProfileString(f_strKey, f_strSubKey, Space(144), strTemp, 144, f_strIniFileName) g_GetIniString = Left(strTemp, InStr(strTemp, Chr$(0)) - 1)ErrExit:End FunctionPublic Function g_WriteIniString(ByVal f_strKey As String, ByVal f_strSubKey As String, _ ByVal f_strValue As Variant, ByVal f_strIniFile As String) As String
On Error GoTo ErrExit Dim i As Integer Dim strTemp As String Dim n As Long
strTemp = f_strValue
For i = 1 To Len(f_strValue) Step 1 If Mid$(f_strValue, i, 1) = vbCr Or Mid$(f_strValue, i, 1) = vbLf Then Mid$(f_strValue, i) = ""
Next
n = WritePrivateProfileString(f_strKey, f_strSubKey, strTemp, f_strIniFile)ErrExit: g_WriteIniString = Err.Description End Function
ByVal f_strSubKey As String, _
ByVal f_strIniFileName As String) As StringOn Error GoTo ErrExit
Dim strTemp As String * 144
Dim nRetCode As Long
Dim strWinDir As String 'the following series of the API function call "GetPrivateProfileString"
'retrieves info from the user's .ini file ---this file originally
'had its values set by the setup program for that module
nRetCode = GetPrivateProfileString(f_strKey, f_strSubKey, Space(144), strTemp, 144, f_strIniFileName)
g_GetIniString = Left(strTemp, InStr(strTemp, Chr$(0)) - 1)ErrExit:End FunctionPublic Function g_WriteIniString(ByVal f_strKey As String, ByVal f_strSubKey As String, _
ByVal f_strValue As Variant, ByVal f_strIniFile As String) As String
On Error GoTo ErrExit Dim i As Integer
Dim strTemp As String
Dim n As Long
strTemp = f_strValue
For i = 1 To Len(f_strValue) Step 1
If Mid$(f_strValue, i, 1) = vbCr Or Mid$(f_strValue, i, 1) = vbLf Then Mid$(f_strValue, i) = ""
Next
n = WritePrivateProfileString(f_strKey, f_strSubKey, strTemp, f_strIniFile)ErrExit:
g_WriteIniString = Err.Description
End Function