19,524
社区成员
发帖
与我相关
我的任务
分享
'----调用例子
' TextBoxRecieve.Text = ""
' Dim Upan() As String = NameUpan(5) ' 找 电子盘数量5 个 ,可以随意定-根据需要
' Dim i As Integer
' For i = 0 To Upan.Length - 1
' TextBoxRecieve.Text &= Upan(i) & " "
' Next
'----
' 功能: NameUpan 找电子盘名称
' 输入: Upan_Num 电子盘数量
' 输出: 电子盘名称字符串数组
Public Function NameUpan(ByVal Upan_Num As Integer) As String() '电子盘数量 Upan_Num
Dim Upan(Upan_Num - 1) As String
Dim Num As Integer = 0
Dim sFile As String(), ll() As String = {"\EmbedSky", "\Temp", "\Windows", "\Application Data", "\My Documents", "\Program Files", "\Recycled", "\网络"}
Dim i As Int16, j As Int16, k As Int16
sFile = System.IO.Directory.GetDirectories("\")
k = sFile.Length
For i = 0 To k - 1
'--不查找的目录-STA
For j = 0 To 7
If sFile(i) = ll(j) Then
Exit For
End If
Next j
'--不查找的目录-END
If j = 8 Then
Upan(Num) = sFile(i) '剩余的目录为 各种电子盘 \FlashDisk , \FlashDisk2 ..
Num = Num + 1
If Num >= Upan_Num Then
Exit For
End If
Else
Upan(Num) = ""
End If
Next i
ReDim Preserve Upan(Num)
Return Upan
End Function
'----
