?? module1.bas
字號:
Attribute VB_Name = "Module1"
Option Explicit
Public fn As String
Public mfile() As String
Public mfilejianhua() As String
Public mfileroad() As String
Public fuxuan As Boolean
Public weishu As Integer
Public listliebiao As Integer
Public Function fenliqudededuogewenjianming(fn As String)
Dim i As Integer
Dim j As Integer
Dim n As Integer
Dim xx As String
Dim leftfn() As String
Dim rightfn() As String
Dim y As Integer
Dim str As String
n = Len(fn) '---取得返回的文件名內包含字符的數目
For i = 1 To n
xx = Mid(fn, i, 1) '---返回字符串中指定數量的字符
'Mid(字符串, 起點 ,終點)
If Asc(xx) = 0 Then
fuxuan = True
Exit For
Else
fuxuan = False
End If
Next i
If fuxuan = True Then
GoTo Start1
Else
GoTo start2
End If
Start1:
n = Len(fn) '---取得返回的文件名內包含字符的數目
ReDim Preserve leftfn(y) '---重分配數組元數的個數,但不改變里面的數據
For i = 1 To n
xx = Mid(fn, i, 1) '---返回字符串中指定數量的字符
'Mid(字符串, 起點 ,終點)
If Asc(xx) = 0 Then
y = y + 1
'---字符串中從左邊算起指定數量的字符
'Left(字符串, 起點)
leftfn(y - 1) = Left$(fn, i - 1)
'---字符串右邊取出的指定數量的字符
'Right(字符串, 起點)[起點從右數起]
fn = Right$(fn, n - i)
GoTo Start1
End If
Next i
leftfn(y) = fn '存儲了復選的多個文件名,其中第一個是路徑,沒有\
'用redim定義的是多維數組,維是從0---Y,復選的文件數等于Y
ReDim mfile(1 To y) As String
For i = 1 To y
mfile(i) = leftfn(i)
Next i
ReDim mfileroad(1 To y) As String
For i = 1 To y
mfileroad(i) = leftfn(0) + "\" + leftfn(i)
Next i
ReDim mfilejianhua(1 To y) As String
For j = 1 To y
n = Len(leftfn(j))
For i = n To 1 Step -1
xx = Mid(leftfn(j), i, 1)
If xx = "." Then
mfilejianhua(j) = Left$(mfile(j), i - 1)
Exit For
End If
Next i
Next j
weishu = y
GoTo last
start2:
ReDim mfileroad(1) As String
ReDim mfile(1) As String
ReDim mfilejianhua(1) As String
mfileroad(1) = fn
n = Len(fn)
For i = n To 1 Step -1
xx = Mid(fn, i, 1)
If xx = "\" Then
mfile(1) = Right$(fn, n - i)
Exit For
End If
Next i
n = Len(mfile(1))
For i = n To 1 Step -1
xx = Mid(mfile(1), i, 1)
If xx = "." Then
mfilejianhua(1) = Left$(mfile(1), i - 1)
Exit For
End If
Next i
weishu = 1
last:
End Function
Public Function jingyibuchuliwenjianming()
If fn = "" Then GoTo last
fenliqudededuogewenjianming (fn)
listliebiao = Form1.List1.ListCount
Dim i As Integer
If listliebiao = 0 Then
If fuxuan = True Then
For i = 1 To weishu
Form1.List1.AddItem mfilejianhua(i), i - 1
Form1.List2.AddItem mfileroad(i), i - 1
'listliebiao = listliebiao + 1
Next i
Else
'~~~=mfile(1)
Form1.List1.AddItem mfilejianhua(1), i
Form1.List2.AddItem mfileroad(1), i
'listliebiao = listliebiao + 1
End If
Else
If fuxuan = True Then
For i = 1 To weishu
Form1.List1.AddItem mfilejianhua(i), listliebiao - 1 + i
Form1.List2.AddItem mfileroad(i), listliebiao - 1 + i
'listliebiao = listliebiao + 1
Next i
Else
'~~~=mfile(1)
Form1.List1.AddItem mfilejianhua(1), listliebiao
Form1.List2.AddItem mfileroad(1), listliebiao
'listliebiao = listliebiao + 1
End If
End If
last:
End Function
'//以。秒,分鐘,小時的顯示時間
Public Sub ToToTime() '----計算時間的過程
Dim MsecTime As Integer
Dim SecTime As String
Dim Sec As String
Dim ShowTime As String
Form1.Text2 = ShowTime
MsecTime = (Form1.mp.TotalTime - 1000) \ 1000
SecTime = str$(MsecTime \ 60)
If Len(SecTime) < 3 Then
SecTime = "0" + Right(SecTime, 1)
Else
SecTime = Right(SecTime, 2)
End If
Sec = str$(MsecTime Mod 60)
If Len(Sec) < 3 Then
Sec = "0" + Right(Sec, 1)
Else
Sec = Right(Sec, 2)
End If
'ShowTime = SecTime + "分" + Sec + "秒"
ShowTime = "00" + ":" + SecTime + ":" + Sec + ":" '//////////////
Form1.Text2 = ShowTime
End Sub
Public Function mp3pinlv()
Form1.Text5 = str$(Form1.mp.SampleFrequency \ 1000) + "kHz"
Form1.Text6 = str$(Form1.mp.BitRate \ 1000) + "kbps"
End Function
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -