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]