VB下幾個非常有用的函數
下麪幾個非常有用的VB函數
&急性;————————(1)————————————
&急性;下麪的API聲明是獲取所有鍵值TrueZq所必需的,位於指定ini文件的一個節下。
&急性;私有聲明函數GetPrivateProfileSection Lib" kernel 32"別名" GetPrivateProfileSectionA"(ByVal LP appname爲字符串,ByVal lpReturnedString爲字符串,ByVal nSize爲Long,ByVal lpFileName爲字符串)爲長
&急性;返廻字符串數組。
&急性;打電話的例子:
&急性;Dim arrClass()作爲字符串
&急性;arrClass = GetInfoSection("class"," d:\type.ini")
公共函數GetInfoSection(strSection As String,strIniFile As String) As String()
Dim strReturn爲String * 32767
Dim strTmp作爲字符串
Dim nStart爲整數,nEnd爲整數,I爲整數
Dim sArray()作爲字符串
調用GetPrivateProfileSection(strSection,strReturn,Len(strReturn),strIniFile)
strTmp = strReturn
i = 1
strTmp時執行""
nStart = nEnd 1
nEnd = InStr(nStart,strReturn,vbNullChar)
strTmp = Mid$(strReturn,nStart,nEnd - nStart)
如果Len(strTmp) >0,則
ReDim Preserve sArray(1到I)
sArray(i) = strTmp
i = i 1
如果…就會結束
環
GetInfoSection = sArray
結束函數
0條評論