Sub loadlove()
Dim str As String
Dim ii As Integer
Dim imgX As ListImage
ListView1.ListItems.Clear
Open "F:\软件\vb\2007\love.txt" For Input As #1
'Open App.path & "\love.txt" For Output As #1
If LOF(1) > 0 Then
While Not EOF(1)
X = DoEvents
Line Input #1, str
Dim youxilujing As String
youxilujing = cutstr(str, "[游戏路径]", ";")
youxilujing = Mid(youxilujing, InStrRev(youxilujing, "\") + 1, -InStrRev(youxilujing, "\") + InStrRev(youxilujing, ".") - 1)
If Dir("f:\模拟游戏\mame\icons\" & youxilujing & ".ico") = "" Then
youxilujing = "005"
End If
Set imgX = ImageList1.ListImages. _
Add(, , LoadPicture("f:\模拟游戏\mame\icons\" & youxilujing & ".ico"))
'添加一个图象到 ImageList2--小图标 ImageList。
Set imgX = ImageList2.ListImages. _
Add(, , LoadPicture("f:\模拟游戏\mame\icons\" & youxilujing & ".ico"))
ListView1.Icons = ImageList1
ListView1.SmallIcons = ImageList2
Set li = ListView1.ListItems.Add(Text:=cutstr(str, "[游戏名称]", ";"))
li.Icon = ImageList1.ListImages.Count '设置 ImageList1 中的一个图标。
li.SmallIcon = ImageList2.ListImages.Count '设置 ImageList2 中的一个图标。
Set si = li.ListSubItems.Add(Text:=Mid(cutstr(str, "[游戏路径]", ";"), InStrRev(cutstr(str, "[游戏路径]", ";"), "\") + 1, -InStrRev(cutstr(str, "[游戏路径]", ";"), "\") + InStrRev(cutstr(str, "[游戏路径]", ";"), ".") - 1) & ".zip")
Set si = li.ListSubItems.Add(Text:=cutstr(str, "[游戏路径]", ";"))
Set si = li.ListSubItems.Add(Text:=cutstr(str, "[模拟器]", ";"))
lindex = lindex + 1
Wend
End If
Close #1
End Sub
我写的小程序的一段