?? inimanager.bas
字號:
Attribute VB_Name = "iniManager"
'聲明寫入ini文件的API函數(shù)
Public Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpString As Any, ByVal lpFilenchame As String) As Long
Public Declare Function WritePrivateProfileSection Lib "kernel32" Alias "WritePrivateProfileSectionA" (ByVal lpAppName As String, ByVal lpString As String, ByVal lpFilenchame As String) As Long
'判斷文件是否存在
Function FileExist(Fname As String) As Boolean
On Local Error Resume Next
FileExist = (Dir(Fname) <> "")
End Function
'讀取ini文件的數(shù)據(jù)項(xiàng)值
Public Function GetKey(Tmp_File As String, Tmp_Key As String) As String
Dim File As Long
'分配文件句柄
File = FreeFile
'如果文件不存在則創(chuàng)建一個(gè)默認(rèn)的Setup.ini文件
If FileExist(Tmp_File) = False Then
GetKey = ""
Call WritePrivateProfileString("Setup Information", "Server Name ", " NtServer", App.Path + "\Setup.ini")
Exit Function
End If
'讀取數(shù)據(jù)項(xiàng)值
Open Tmp_File For Input As File
Do While Not EOF(1)
Line Input #File, buffer
If Left(buffer, Len(Tmp_Key)) = Tmp_Key Then
pos = InStr(buffer, "=")
GetKey = Trim(Mid(buffer, pos + 1))
End If
Loop
Close File
End Function
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -