'Search File
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 Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
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:\", "myfile.ext", 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
Declare Function SearchTreeForFile Lib "imagehlp" (ByVal RootPath As String, ByVal InputPathName As String, ByVal OutputPathBuffer As String) As Long
?RootPath
[in] Pointer to a null-terminated string that specifies the path where the function should begin searching for the file.
?InputPathName
[in] Pointer to a null-terminated string that specifies the file for which the function will search. You can use a partial path.
?OutputPathBuffer
[out] Pointer to a buffer that receives the full path to the file that is found. This string is not modified if the return value is FALSE.