Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> Visual Basic >> Snippet

Find a single file - imageshlp.dll


Private Declare Function SearchTreeForFile Lib "imagehlp.dll" ( ByVal sRootPath _
    As String , ByVal InputPathName As String , ByVal OutputPathBuffer As String ) _
    As Boolean


Dim temp As String
temp = SearchForFile( "d:\data" , "webcam.jpg" )

Function SearchForFile( ByVal StartingDir As String , ByVal FileName As String )   As String
   'locate a Single file, first occurence - Get the full path name
   'returns Null String If no found
    Dim buffer As String * 260      'max length for a filename
    If SearchTreeForFile(StartingDir, FileName, buffer) Then
        'non-zero rReturn means file was found
       SearchForFile = Left$(buffer, InStr(buffer, vbNullChar) - 1)
    End If
End Function