例如
xx INI档内容如下[6]
资料笔数=9
致能=,yes,,,,,,,
[3]
资料笔数=9
致能=,,yes,yes,,,,,
[-1]
资料笔数=9
致能=,,yes,yes,,,,,
[-2]
资料笔数=9
致能=,,yes,yes,,,,,[问题]==================有 "现成" 的 函数 或 API 可以知道(a) 项目总数 = 4
(b) 项目 = [6],[3],[-1],[-2]吗 ?
xx INI档内容如下[6]
资料笔数=9
致能=,yes,,,,,,,
[3]
资料笔数=9
致能=,,yes,yes,,,,,
[-1]
资料笔数=9
致能=,,yes,yes,,,,,
[-2]
资料笔数=9
致能=,,yes,yes,,,,,[问题]==================有 "现成" 的 函数 或 API 可以知道(a) 项目总数 = 4
(b) 项目 = [6],[3],[-1],[-2]吗 ?
解决方案 »
- 求助:将控件数组作为方法参数遇到的问题
- 在win2003上写的程序编译成exe文件打包后,到win2000下安装,运行的时候For Each objProcess In objWMIService这一句为什么会出现automation错误呢?看完整代码
- 关于安装打包程序的制作
- 有关事务的问题
- 格式转换
- 100分求教,SHELL命令后如何读到窗口所有信息。
- VB与word的问题,是高手就进来看一下!!!,分不够的话,再加
- 如果要给一些软件作外挂,怎么得到INTERFACE
- 怎样在用户控件中引用第三方的控件?
- VBA 能否在 listbox 上敲回车响应按钮的单击事件
- FindWindowEx找不到自身窗口的按钮
- 请教高手一个VB网络编程方面问题!
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 LongFunction GetProString(段 As String, 标题 As String, 默认值 As String, 文件名 As String) As String
Const ProStringLen = 8096
Dim Res As Long, S As String, i As Long
S = Space(ProStringLen)
Res = GetPrivateProfileString(段, 标题, 默认值, S, ProStringLen, 文件名)
S = Trim(Left(S, Res))
If S <> "" Then
i = Len(S)
Do While Mid(S, i, 1) = vbNullChar
i = i - 1
Loop
S = Left(S, i)
End If
GetProString = Trim(S)
End FunctionPrivate Sub Form_Load()
Dim Apps() As String, i As Integer
Apps = Split(GetProString(vbNullString, vbNullString, "", "c:\xx.ini"), vbNullChar)
Debug.Print "项目总数=" & UBound(Apps) - LBound(Apps) + 1
For i = LBound(Apps) To UBound(Apps)
Debug.Print "第" & i; "项 = " & Apps(i)
Next i
End
End Sub
Private Function iniFilter()
Open App.Path & "\" & "xx.ini" For Input As #1
b = ""
Do Until EOF(1)
Line Input #1, nextline
b = b & nextline
Loop
Close #1strFile = ""
pstring1 = "["
pString2 = "]"
pStart = InStr(b, pstring1)
If pStart <> 0 Then
pstop = InStr(pStart, b, pString2)
End If
Do While pStart <> 0
strFileName = Mid(b, pStart, pstop - pStart + 1)
strFile = strFile & strFileName & ","
i = i + 1
pStart = InStr(pstop, b, pstring1)
If pStart = 0 Then
Exit Do
End If
pstop = InStr(pStart, b, pString2, 1)
Loop
strFile = Left(strFile, Len(strFile) - 1)
MsgBox "项目总数 = " & i
MsgBox "项目 =" & strFile
End FunctionPrivate Sub Form_Load()
iniFilter
End Sub