文件的一部分
[Comments]
Lines=13
Line1=EDS file for Delta ASDA-A2 Servo Drive within CANopen Slave
Line2=
Line3=
Line4=
Line5=
Line6=
Line7=
Line8=
Line9=
Line10=
Line11=
Line12=
Line13=
[FileInfo]
FileName=E:\ASDA-A2_v06.eds
FileVersion=1
FileRevision=1
EDSVersion=4.0
Description=EDS file for Delta ASDA-A2 Servo Drive within CANopen Slave
CreationTime=10:06AM
CreationDate=05-04-2009
CreatedBy=ASD.TN.Brian
ModificationTime=06:25PM
ModificationDate=05-04-2009
ModifiedBy=ASD.TN.Brian
[DeviceInfo]
Vendorname=Delta Electronics,INC.
VendorNumber=0x000001DD
ProductName=ASDA-A2 Drive
ProductNumber=0x00006000
RevisionNumber=0x02000001
OrderCode=ASDA-A2
BaudRate_10=0
BaudRate_20=0
BaudRate_50=0
BaudRate_125=1
BaudRate_250=1
BaudRate_500=1
BaudRate_800=0
BaudRate_1000=1
SimpleBootUpMaster=0
SimpleBootUpSlave=1
Granularity=5
DynamicChannelsSupported=0
GroupMessaging=0
NrOfRXPDO=4
NrOfTXPDO=4
LSS_Supported=0
CompactPDO=0x00
[DummyUsage]
Dummy0001=0
Dummy0002=0
Dummy0003=0
Dummy0004=0
Dummy0005=0
Dummy0006=0
Dummy0007=0
[MandatoryObjects]
SupportedObjects=3
1=0x1000
2=0x1001
3=0x1018
[1000]
ParameterName=Device Type
ObjectType=0x7
DataType=0x0007
LowLimit=
HighLimit=
AccessType=ro
DefaultValue=0x04020192
PDOMapping=0
ObjFlags=0x0
[1001]
ParameterName=Error Register
ObjectType=0x7
DataType=0x0005
LowLimit=
HighLimit=
AccessType=ro
DefaultValue=0
PDOMapping=1
ObjFlags=0x0
完整版是在这里下载的http://download.csdn.net/download/qq_23145067/8141535
我要做一个这样的树形结构,要求是用文件中含[ ]的部分形成结构
我在网上搜到了一段程序是这么写的
Option Explicit
Public Sub LoadTree(TreePath As String)
Dim i As Long, j As Long, s() As String
s = Split(GetTxt(TreePath), vbCrLf)
ReDim n(0 To UBound(s)) As Long
For i = 0 To UBound(s)
For j = 1 To Len(s(i))
If Asc(Mid(s(i), j, 1)) <> 32 Then Exit For
Next
n(i) = j
s(i) = Mid(s(i), j)
Next
For i = 0 To UBound(n)
If n(i) = 1 Then CreateRoot n, s, 2, TreeView1.Nodes.Add(, , , s(i)).Index, i + 1
Next
End Sub
Private Sub CreateRoot(n() As Long, s() As String, Root As Long, R As Long, T As Long)
Dim i As Long
For i = T To UBound(n)
If n(i) = Root Then
CreateRoot n, s, Root + 1, TreeView1.Nodes.Add(R, 4, , s(i)).Index, i + 1
ElseIf n(i) < Root Then
Exit For
End If
Next
End Sub
Public Function GetTxt(TxtPath As String) As String
Dim F As Long: F = FreeFile
Open TxtPath For Input As #F
GetTxt = StrConv(InputB(LOF(F), F), vbUnicode)
Close #F
End Function
Private Sub Form_Load()
TreeView1.LineStyle = tvwRootLines
TreeView1.LabelEdit = tvwManual
LoadTree "F:\VB标准\试验库\MyTree\tree.txt"
End Sub
运行下来是这样的
请问各位这个程序需要进行哪些修改?谢谢!