EnableExplicit
Define Buffer$ = Space(256)
Define Result
Result = SearchTreeForFile_("D:\Temp\", "Dummy.txt", @Buffer$)
If Result=0
MessageRequester("", "No file with this name was found.", 0)
Else
MessageRequester("", "First found file: " + Buffer$, 0)
EndIf
PB5.71b2 on Win 7 x64 The referenced file definitely exists.
Last edited by davebar on Tue Jul 30, 2019 2:57 pm, edited 1 time in total.
The native function ExamineDirectory() would have been my first choice, but I wanted to check out if your Win API example [1] might have been a better option
[1] https://www.rsbasic.de/aktualisierung/w ... 0suchen.pb
Many thanks for taking the time to help.
EnableExplicit
Import "imagehlp.lib"
SearchTreeForFile(Path.p-Ascii,File.p-ascii,*Result)
EndImport
Global *buffer
*buffer = AllocateMemory(#MAX_PATH)
If *buffer
If SearchTreeForFile("D:\Temp\","Dummy.txt",*buffer)
MessageRequester("", "First found file: " + PeekS(*buffer,-1,#PB_Ascii), 0)
Else
MessageRequester("", "No file with this name was found.", 0)
EndIf
FreeMemory(*buffer)
EndIf
End
Or grab the proper lib from MSVS and import the W version directly.