'INI setting Win32 APIs
Private Declare Function WritePrivateProfileString Lib "kernel32" _
Alias "WritePrivateProfileStringA" _
(ByVal SectionName As String, _
ByVal KeyName As String, _
ByVal KeyValue As String, _
ByVal FileName As String) As Integer
Private Declare Function GetPrivateProfileString Lib "kernel32" _
Alias "GetPrivateProfileStringA" _
(ByVal SectionName As String, _
ByVal KeyName As String, _
ByVal [Default] As String, _
ByVal ReturnedString As String, _
ByVal StringSize As Integer, _
ByVal FileName As String) As Integer
'//INI FILE
Private Shared sINIFileName As String = InstallDir + "mis.ini"
Public Shared Function INIRead(ByVal sSection As String, ByVal sKeyName As String, ByVal oDefaultValue As Object) As Object
Dim iRet As Integer
Dim sBuf As String = Space(128)
Try
iRet = GetPrivateProfileString(sSection, sKeyName, CStr(oDefaultValue), sBuf, sBuf.Length, sINIFileName)
Return sBuf.Substring(0, iRet)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Function
Public Shared Sub INIWrite(ByVal sSection As String, ByVal sKeyName As String, ByVal oSetting As Object)
Try
WritePrivateProfileString(sSection, sKeyName, CStr(oSetting), sINIFileName)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub