VB6 类模块,再引用另一个类模块的问题

superitman2006 superitman2006 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我做了一个通用INI处理的类,代码如下:
Option Explicit

Private 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 Long
Private Declare Function GetPrivateProfileInt Lib "kernel32" Alias "GetPrivateProfileIntA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal nDefault As Long, ByVal lpFileName As String) As Long
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
Private IniFileName As String
Function GetIniS(ByVal SectionName As String, ByVal KeyWord As String, Optional ByVal DefString As String) As String
Dim ResultString As String * 144, Temp As Integer
Dim s As String, i As Integer

Temp% = GetPrivateProfileString(SectionName, KeyWord, "", ResultString, 144, IniFileName)

If Temp% > 0 Then
s = ""
For i = 1 To 144
If Asc(Mid$(ResultString, i, 1)) = 0 Then
Exit For
Else
s = s & Mid$(ResultString, i, 1)
End If
Next
Else
Temp% = WritePrivateProfileString(SectionName, KeyWord, DefString, IniFileName)
s = DefString
End If

GetIniS = s

End Function

Function GetIniN(ByVal SectionName As String, ByVal KeyWord As String, Optional ByVal DefValue As Integer) As Integer
Dim D As Long, s As String

D = DefValue
GetIniN = GetPrivateProfileInt(SectionName, KeyWord, DefValue, IniFileName)

If D <> DefValue Then
s = "" & D
D = WritePrivateProfileString(SectionName, KeyWord, s, IniFileName)
End If

End Function

Sub SetIniS(ByVal SectionName As String, ByVal KeyWord As String, ByVal ValStr As String)
Dim RES%

RES% = WritePrivateProfileString(SectionName, KeyWord, ValStr, IniFileName)

End Sub

Sub SetIniN(ByVal SectionName As String, ByVal KeyWord As String, ByVal ValInt As Integer)
Dim RES%, s$

s$ = Str$(ValInt)
RES% = WritePrivateProfileString(SectionName, KeyWord, s$, IniFileName)

End Sub
Public Property Get FileName() As Variant
FileName = IniFileName
End Property

Public Property Let FileName(ByVal vNewValue As Variant)
IniFileName = vNewValue
End Property

现在想再做一个,指定了文件名和属性的新类
比如说,我指定这个新类是在当前软件运行下的 VER.INI文件
有两个新的属性,
SoftVer 存取当前软件版本号
DataBaseVer 存取当前软件数据库版本号

请问大家如果用我已写好的类,写这个新的类呢?
...全文
评论 2
收藏 已收藏
分享
返回顶部
superitman2006
VB基础类 7,788 成员 197,583 内容