' Это поиск через апи - млжет подойдёт... Еслм что конретней... Рассказывай... 'Create a form with a command button (command1), a list box (list1) 'and four text boxes (text1, text2, text3 and text4). 'Type in the first textbox a startingpath like c:\ 'and in the second textbox you put a pattern like *.* or *.txt Private Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As LongPrivate Declare Function FindNextFile Lib "kernel32" Alias "FindNextFileA" (ByVal hFindFile As Long, lpFindFileData As WIN32_FIND_DATA) As LongPrivate Declare Function GetFileAttributes Lib "kernel32" Alias "GetFileAttributesA" (ByVal lpFileName As String) As LongPrivate Declare Function FindClose Lib "kernel32" (ByVal hFindFile As Long) As LongConst MAX_PATH = 260Const MAXDWORD = &HFFFFConst INVALID_HANDLE_VALUE = -1Const FILE_ATTRIBUTE_ARCHIVE = &H20Const FILE_ATTRIBUTE_DIRECTORY = &H10Const FILE_ATTRIBUTE_HIDDEN = &H2Const FILE_ATTRIBUTE_NORMAL = &H80Const FILE_ATTRIBUTE_READONLY = &H1Const FILE_ATTRIBUTE_SYSTEM = &H4Const FILE_ATTRIBUTE_TEMPORARY = &H100Private Type FILETIMEdwLowDateTime As Long dwHighDateTime As Long End Type Private 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 TypeFunction StripNulls(OriginalStr As String) As StringIf (InStr(OriginalStr, Chr(0)) > 0) ThenOriginalStr = Left(OriginalStr, InStr(OriginalStr, Chr(0)) - 1) End IfStripNulls = OriginalStr End FunctionFunction FindFilesAPI(path As String, SearchStr As String, FileCount As Integer, DirCount As Integer)'KPD-Team 1999 'E-Mail: KPDTeam@Allapi.net <mailto:KPDTeam@Allapi.net> 'URL: <http://www.allapi.net/> Dim FileName As String ' Walking filename variable...Dim DirName As String ' SubDirectory NameDim dirNames() As String ' Buffer for directory name entriesDim nDir As Integer ' Number of directories in this pathDim i As Integer ' For-loop counter...Dim hSearch As Long ' Search HandleDim WFD As WIN32_FIND_DATADim Cont As IntegerIf Right(path, 1) <> "\" Then path = path & "\"' Search for subdirectories. nDir = 0 ReDim dirNames(nDir)Cont = True hSearch = FindFirstFile(path & "*", WFD) If hSearch <> INVALID_HANDLE_VALUE ThenDo While ContDirName = StripNulls(WFD.cFileName) ' Ignore the current and encompassing directories. If (DirName <> ".") And (DirName <> "..") Then' Check for directory with bitwise comparison. If GetFileAttributes(path & DirName) And FILE_ATTRIBUTE_DIRECTORY ThendirNames(nDir) = DirName DirCount = DirCount + 1 nDir = nDir + 1 ReDim Preserve dirNames(nDir)End IfEnd IfCont = FindNextFile(hSearc
Ответить
|