📄 readini.bas
字号:
Attribute VB_Name = "INIFileReader"
Option Explicit
Const INI_SECTION = "Data Files"
Const INI_FILENAME = "VBDBHT.INI"
Const MAX_PATH = 128
#If Win32 Then
Declare Function GetPrivateProfileString _
Lib "Kernel32" Alias "GetPrivateProfileStringA" (ByVal lpSectionName As String, _
ByVal lpKeyName As Any, ByVal lpDefault As String, _
ByVal lpReturnedString As String, ByVal Size As Integer, _
ByVal lpFileName As String) As Integer
#Else
Declare Function GetPrivateProfileString _
Lib "Kernel" (ByVal lpSectionName As String, _
ByVal lpKeyName As Any, ByVal lpDefault As String, _
ByVal lpReturnedString As String, ByVal Size As Integer, _
ByVal lpFileName As String) As Integer
#End If
Public Function BiblioPath() As String
' Returns the fully qualiied path name to BIBLIO.MDB,
' as recorded in VBDBHT.INI.
' Returns an empty string if information is not found.
Dim lpReturnedString As String * MAX_PATH
Dim bytesBack As Integer
bytesBack = GetPrivateProfileString(INI_SECTION, _
"BIBLIO", "", lpReturnedString, MAX_PATH, INI_FILENAME)
BiblioPath = IIf(bytesBack > 0, Left$(lpReturnedString, bytesBack) & "\BIBLIO.MDB", "")
End Function
Public Function DataPath() As String
' Returns the top-level VBDBHT directory
Dim lpReturnedString As String * MAX_PATH
Dim bytesBack As Integer
bytesBack = GetPrivateProfileString(INI_SECTION, _
"Data", "", lpReturnedString, MAX_PATH, INI_FILENAME)
DataPath = IIf(bytesBack > 0, Left$(lpReturnedString, bytesBack), "")
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -