VB “制作文件安装位置”窗口
目前只做到这样:按两个按钮退出,按“选择安装位置”弹出窗口。如何制作(让windows弹出)类似这样的窗口:...
目前只做到这样:
按两个按钮退出,
按 “选择安装位置” 弹出窗口。
如何制作(让windows弹出)类似这样的窗口: 展开
按两个按钮退出,
按 “选择安装位置” 弹出窗口。
如何制作(让windows弹出)类似这样的窗口: 展开
展开全部
Private Sub imgOpen_Click()
Call openfile 'openfile程序在标准模块中
End Sub
这是写在主窗体
Public Function openfile() '打开对话框
Dim multi As Boolean
multi = False
Dim i, j, n, cord As Integer
Dim addr, ttlname As String
On Error GoTo can
frmPlayer.CommonDialog1.ShowOpen
If frmPlayer.CommonDialog1.FileName = "" Then Exit Function
If Right(frmPlayer.CommonDialog1.FileTitle, 3) = "m3u" Then '播放列表文件
n = frmPlayer.listName.ListCount
i = 1
cord = FreeFile
Open frmPlayer.CommonDialog1.FileName For Input As #cord
Do While Not EOF(cord)
Line Input #cord, inputdata
Do While left(Right(inputdata, i), 1) <> "\"
i = i + 1
Loop
frmPlayer.listName.List(n) = Right(inputdata, i - 1)
frmPlayer.listUrl.List(n) = inputdata
i = 1
n = n + 1
Loop
Close #cord
Else '判断是单选还是多选
For i = 1 To Len(frmPlayer.CommonDialog1.FileName)
If Asc(Mid(frmPlayer.CommonDialog1.FileName, i, 1)) = 0 Then
multi = True
Exit For
End If
Next i
Select Case multi
Case False '单选一首歌
frmPlayer.listName.AddItem frmPlayer.CommonDialog1.FileTitle
frmPlayer.listUrl.AddItem frmPlayer.CommonDialog1.FileName
frmPlayer.lblTotlenum.Caption = frmPlayer.listName.ListCount
Case True '多选
ttlname = frmPlayer.CommonDialog1.FileName
addr = left(ttlname, i - 1)
ttlname = Right(ttlname, Len(ttlname) - i)
goon:
For i = 1 To Len(ttlname)
If Asc(Mid(ttlname, i, 1)) = 0 Then
frmPlayer.listName.AddItem left(ttlname, i - 1)
ttlname = Right(ttlname, Len(ttlname) - i)
j = j + 1
GoTo goon
End If
Next i
frmPlayer.listName.AddItem ttlname
For i = frmPlayer.listName.ListCount - j To frmPlayer.listName.ListCount
frmPlayer.listUrl.AddItem addr & "\" & frmPlayer.listName.List(i - 1)
Next i
j = 0
frmPlayer.lblTotlenum.Caption = frmPlayer.listName.ListCount
End Select
End If
frmPlayer.CommonDialog1.FileName = ""
can:
End Function
这要写在一个类模块中!!
这是我根据我的一个播放器中摘取的,由于时间有限,就不改了@
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询