|
利用史上最快搜索软件Everything(>-<)夸张一点,搜索电脑文件以利后续处理。
实例代码是搜索电脑文件名内含8位数字的xls,没有64环境,请大家自己测试。
将dll放入自己设定文件夹,然后api声明指向它就可以了。实例代码是搜索电脑
文件名内含8位数字的xls文件,用到了正则表达式搜索
- Public Declare Function Everything_SetSearchA Lib "C:\WINDOWS\system32\Everything32.dll" (ByVal search As String) As Long
- Public Declare Function Everything_QueryW Lib "C:\WINDOWS\system32\Everything32.dll" (ByVal bWait As Integer) As Integer
- Public Declare Function Everything_GetNumResults Lib "C:\WINDOWS\system32\Everything32.dll" () As Long
- Public Declare Function Everything_GetResultFileNameA Lib "C:\WINDOWS\system32\Everything32.dll" (ByVal index As Long) As String
- Public Declare Function Everything_GetLastError Lib "C:\WINDOWS\system32\Everything32.dll" () As Long
- Public Declare Function Everything_GetResultFullPathNameA Lib "C:\WINDOWS\system32\Everything32.dll" (ByVal index As Long, ByVal buf As String, ByVal size As Long) As Long
- Sub test()
- Everything_SetSearchA ("file:regex:^[0-9]{8} ext:xls")
- Everything_QueryW (1)
- Dim NumResults As Long, arr$()
- Dim i As Long
- NumResults = Everything_GetNumResults()
- If NumResults > 0 Then
- ReDim arr(1 To NumResults)
- For i = 0 To NumResults - 1
- Dim filename As String
- filename = String(260, vbNullChar)
- Everything_GetResultFullPathNameA i, filename, 260
- arr(i + 1) = filename
- Next
- End If
- If NumResults > 0 Then Sheet1.Range("a1").Resize(NumResults, 1) = arr
- End Sub
复制代码
Everything-SDK.zip
(168.99 KB, 下载次数: 62)
Everything-1.3.4.686.x86.Multilingual.zip
(793.7 KB, 下载次数: 60)
Everything-1.3.4.686.x64.Multilingual.zip
(906.88 KB, 下载次数: 97)
|
评分
-
3
查看全部评分
-
|