udfSearchTreeForFile
str udfSearchTreeForFile (str, str)
;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfSearchTreeForFile (strFolderRoot, strFileName)
intMaxPath = 261 ; MAX_PATH + 1 for sure.
strFilePath = ""
hdlBB = BinaryAlloc (intMaxPath)
BinaryEodSet (hdlBB, intMaxPath)
blnResult = DllCall (DirWindows (1) : "ImageHlp.dll", long : "SearchTreeForFile", lpstr : strFolderRoot, lpstr : strFileName, lpbinary : hdlBB)
If blnResult Then strFilePath = BinaryPeekStr (hdlBB, 0, intMaxPath)
hdlBB = BinaryFree (hdlBB)
Return strFilePath
;..........................................................................................................................................
; This UDF "udfSearchTreeForFile" searches for the file specified by the parameter strFilename
; beginning at the path specified by the parameter strFolderRoot.
; The first file found, which match the given strFileName, will stop the search.
; The maximum path depth that is allowed in the root path is 32 directories.
;..........................................................................................................................................
; Alternative call:
; blnResult = DllCall (DirWindows (1) : "Dbghelp.dll", long : "SearchTreeForFile", lpstr : strFolderRoot, lpstr : strFileName, lpbinary : hdlBB)
;..........................................................................................................................................
; Published by Guido sedar@yahoo.com, Wednesday, August 29, 2001 04:30 AM, WinBatch Forum
; (c)Detlev Dalitz.20100227.
;..........................................................................................................................................
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------


; Test.

Message ("Demo  udfSearchTreeForFile (strFolderRoot, strFilename)", udfSearchTreeForFile (DirWindows (1), "ImageHlp.dll"))

Exit