vb6源碼分享,列出目錄下所有文件(多級)
[code[
Function GetFileList(Path As String, Optional FileType As String = "*.*")
'PATH要求\結尾
On Error GoTo DoErr
Dim Sz, ID As Long, ub As Long, AddC As Long
AddC = 30
ub = AddC
ReDim Sz(AddC)
Dim F As String
F = Dir(Path & FileType)
While F <> ""
ID = ID + 1
Sz(ID) = F
F = Dir
Wend
ReDim Preserve Sz(ID)
GetFileList = Sz
Exit Function
DoErr:
ub = ub + AddC
ReDim Preserve Sz(ub)
Resume
End Function
[/code]