![]() ![]() |
|
VB下几个非常有用的函数 | |
作者:佚名 文章来源:不详 点击数 更新时间:2008/3/1 11:02:58 文章录入:杜斌 责任编辑:杜斌 | |
|
|
VB下几个非常有用的函数 ´————————(1)———————————— ´获得指定ini文件中某个节下面的所有键值 TrueZq,,需要下面的API声明 ´Private Declare Function GetPrivateProfileSection Lib "kernel32" Alias "GetPrivateProfileSectionA" (ByVal lpAppName As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long ´返回一个字符串数组 ´调用举例: ´Dim arrClass() As String ´arrClass = GetInfoSection("class", "d:/type.ini") Public Function GetInfoSection(strSection As String, strIniFile As String) As String() Dim strReturn As String * 32767 Dim strTmp As String Dim nStart As Integer, nEnd As Integer, i As Integer Dim sArray() As String Call GetPrivateProfileSection(strSection, strReturn, Len(strReturn), strIniFile) strTmp = strReturn i = 1 Do While strTmp <> "" nStart = nEnd + 1 nEnd = InStr(nStart, strReturn, vbNullChar) strTmp = Mid$(strReturn, nStart, nEnd - nStart) If Len(strTmp) > 0 Then ReDim Preserve sArray(1 To i) sArray(i) = strTmp i = i + 1 End If Loop GetInfoSection = sArray End Function |
|
![]() ![]() |