Results 1 to 3 of 3

Thread: Scan for files

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2005
    Posts
    107

    Scan for files

    Is there an easy way to scan for certain files? Say I wanted my app to scan for 1234.exe and 1234.dll?

  2. #2

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Scan for files

    VB Code:
    1. Private Declare Function SearchTreeForFile Lib "imagehlp" _
    2. (ByVal RootPath As String, ByVal InputPathName As String, _
    3. ByVal OutputPathBuffer As String) As Long
    4.  
    5. Private Const MAX_PATH = 260
    6.  
    7. Private Sub Command1_Click()
    8.     Dim tempStr As String, Ret As Long
    9.     'create a buffer string
    10.     tempStr = String(MAX_PATH, 0)
    11.     'returns 1 when successfull, 0 when failed
    12.     Ret = SearchTreeForFile("c:\", "1234.exe", tempStr)
    13.     If Ret <> 0 Then
    14.         MsgBox "Located file at " + Left$(tempStr, InStr(1, tempStr, Chr$(0)) - 1)
    15.     Else
    16.         MsgBox "File not found!"
    17.     End If
    18. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width