Is there an easy way to scan for certain files? Say I wanted my app to scan for 1234.exe and 1234.dll?
Printable View
Is there an easy way to scan for certain files? Say I wanted my app to scan for 1234.exe and 1234.dll?
There isn't easy way - you have to develop your own logic all by yourself, though.
For some nicely wrapped samples visit Randy Birch's site .
VB Code:
Private Declare Function SearchTreeForFile Lib "imagehlp" _ (ByVal RootPath As String, ByVal InputPathName As String, _ ByVal OutputPathBuffer As String) As Long Private Const MAX_PATH = 260 Private Sub Command1_Click() Dim tempStr As String, Ret As Long 'create a buffer string tempStr = String(MAX_PATH, 0) 'returns 1 when successfull, 0 when failed Ret = SearchTreeForFile("c:\", "1234.exe", tempStr) If Ret <> 0 Then MsgBox "Located file at " + Left$(tempStr, InStr(1, tempStr, Chr$(0)) - 1) Else MsgBox "File not found!" End If End Sub