📄 cini.cls
字号:
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "cINI"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'****************************************************************************
'人人为我,我为人人
'枕善居汉化收藏整理
'发布日期:2007/09/20
'描 述:界面清爽VB版高级专业防火墙 Ver 2.0.3
'网 站:http://www.Mndsoft.com/ (VB6源码博客)
'网 站:http://www.VbDnet.com/ (VB.NET源码博客,主要基于.NET2005)
'e-mail :Mndsoft@163.com
'e-mail :Mndsoft@126.com
'OICQ :88382850
' 如果您有新的好的代码别忘记给枕善居哦!
'****************************************************************************
Option Explicit
' Private variables to store the settings made:
Private m_sPath As String
Private m_sKey As String
Private m_sSection As String
Private m_sDefault As String
Private m_lLastReturnCode As Long
' Declares for cIniFile:
#If Win32 Then
' Profile String functions:
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, _
ByVal lpKeyName As Any, _
ByVal lpString As String, _
ByVal lpFileName As String) As Long
Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, _
ByVal lpKeyName As Any, _
ByVal lpDefault As Any, _
ByVal lpReturnedString As String, _
ByVal nSize As Long, _
ByVal lpFileName As String) As Long
#Else
' Profile String functions:
' If you are developing in VB5, delete this section
' otherwise SetupKit gets **confused**!
Private Declare Function WritePrivateProfileString Lib "Kernel" (ByVal lpApplicationName As String, _
ByVal lpKeyName As Any, _
ByVal lpString As Any, _
ByVal lpFileName As String) As Integer
Private Declare Function GetPrivateProfileString Lib "Kernel" (ByVal lpApplicationName As String, _
ByVal lpKeyName As Any, _
ByVal lpDefault As Any, _
ByVal lpReturnedString As String, _
ByVal nSize As Integer, _
ByVal lpFileName As String) As Integer
#End If
Public Property Get Default() As String
' What to return if something goes wrong:
Default = m_sDefault
End Property
Public Property Let Default(ByVal sDefault As String)
' What to return if something goes wrong:
m_sDefault = sDefault
End Property
Public Sub DeleteSection()
' Delete the Section in Path
m_lLastReturnCode = WritePrivateProfileString(m_sSection, 0&, 0&, m_sPath)
End Sub
Public Sub DeleteValue()
' Delete the value at Key within Section of Path
m_lLastReturnCode = WritePrivateProfileString(m_sSection, m_sKey, vbNullString, m_sPath)
End Sub
Public Property Get INISection() As String
' Return all the keys and values within the current
' section, separated by chr$(0):
Dim sBuf As String
Dim iSize As String
Dim iRetCode As Long
On Error Resume Next
sBuf = Space$(9999)
iSize = Len(sBuf)
iRetCode = GetPrivateProfileString(m_sSection, 0&, m_sDefault, sBuf, iSize, m_sPath)
If iSize > 0 Then
INISection = Left$(sBuf, iRetCode)
Else
INISection = vbNullString
End If
End Property
Public Property Let INISection(sSection As String)
' Set one or more the keys within the current section.
' Keys and Values should be separated by chr$(0):
m_lLastReturnCode = WritePrivateProfileString(m_sSection, 0&, sSection, m_sPath)
End Property
Public Property Get Key() As String
' The KEY= bit to look for
Key = m_sKey
End Property
Public Property Let Key(ByVal sKey As String)
' The KEY= bit to look for
m_sKey = sKey
End Property
Private Property Get LastReturnCode() As Long
' Did the last call succeed?
' 0 if not!
LastReturnCode = m_lLastReturnCode
End Property
Public Property Get Path() As String
' The filename of the INI file:
Path = m_sPath
End Property
Public Property Let Path(ByVal sPath As String)
' The filename of the INI file:
m_sPath = sPath
End Property
Public Property Get Section() As String
' The [SECTION] bit to look for
Section = m_sSection
End Property
Public Property Let Section(ByVal sSection As String)
' The [SECTION] bit to look for
m_sSection = sSection
End Property
Public Property Get Value() As String
' Get the value of the current Key within Section of Path
Dim sBuf As String
Dim iSize As String
Dim iRetCode As Long
sBuf = Space$(9999)
iSize = Len(sBuf)
iRetCode = GetPrivateProfileString(m_sSection, m_sKey, m_sDefault, sBuf, iSize, m_sPath)
If iSize > 0 Then
Value = Left$(sBuf, iRetCode)
Else
Value = vbNullString
End If
End Property
Public Property Let Value(svalue As String)
' Set the value of the current Key within Section of Path
Dim iPos As Long
' Strip chr$(0):
iPos = InStr(svalue, vbNullChar)
Do While iPos <> 0
svalue = Left$(svalue, (iPos - 1)) & Mid$(svalue, (iPos + 1))
iPos = InStr(svalue, vbNullChar)
DoEvents
Loop
m_lLastReturnCode = WritePrivateProfileString(m_sSection, m_sKey, svalue, m_sPath)
End Property
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -