我知道怎么做了
Option ExplicitPublic Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Long
Public Declare Function FindNextFile Lib "kernel32" Alias "FindNextFileA" (ByVal hFindFile As Long, lpFindFileData As WIN32_FIND_DATA) As Long
Public Declare Function FindClose Lib "kernel32" (ByVal hFindFile As Long) As Long
Public Const INVALID_HANDLE_VALUE = -1
Public Const MAX_PATH = 260Public Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End TypePublic Type WIN32_FIND_DATA
dwFileAttributes As Long
ftCreationTime As FILETIME
ftLastAccessTime As FILETIME
ftLastWriteTime As FILETIME
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * MAX_PATH
cAlternate As String * 14
End TypePrivate Sub Command1_Click()
List1.Clear
findFile Text1.Text
End SubPublic Function findFile(filename As String) As Boolean
Dim hff As Long
Dim X As WIN32_FIND_DATA
hff = FindFirstFile(filename, X)If hff = INVALID_HANDLE_VALUE Then
findFile = False
Exit Function
Else
findFile = True
End If
List1.AddItem X.cFileName
Do While FindNextFile(hff, X)
List1.AddItem X.cFileName
Loop
hff = FindClose(hff)
findFile = True
End Function
Option ExplicitPublic Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Long
Public Declare Function FindNextFile Lib "kernel32" Alias "FindNextFileA" (ByVal hFindFile As Long, lpFindFileData As WIN32_FIND_DATA) As Long
Public Declare Function FindClose Lib "kernel32" (ByVal hFindFile As Long) As Long
Public Const INVALID_HANDLE_VALUE = -1
Public Const MAX_PATH = 260Public Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End TypePublic Type WIN32_FIND_DATA
dwFileAttributes As Long
ftCreationTime As FILETIME
ftLastAccessTime As FILETIME
ftLastWriteTime As FILETIME
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * MAX_PATH
cAlternate As String * 14
End TypePrivate Sub Command1_Click()
List1.Clear
findFile Text1.Text
End SubPublic Function findFile(filename As String) As Boolean
Dim hff As Long
Dim X As WIN32_FIND_DATA
hff = FindFirstFile(filename, X)If hff = INVALID_HANDLE_VALUE Then
findFile = False
Exit Function
Else
findFile = True
End If
List1.AddItem X.cFileName
Do While FindNextFile(hff, X)
List1.AddItem X.cFileName
Loop
hff = FindClose(hff)
findFile = True
End Function
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货