A Find File Procedure No Looping
This procedure finds a file and returns the full path, provided a partial path it will search all sub dirs. No looping only 1 API - this is the kind. I can't really take credit for putting an api to use, just sharing something that you might find useful.
AI
Yapay Zeka Özeti: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Kaynak Kod
Private Function FindFile(sFile As String, sRootPath As String) As String ' Search for the file specified and return the full path if found Dim sPathBuffer As String Dim iEnd As Integer 'Allocate some buffer space (you may need more) sPathBuffer = Space(512) If SearchTreeForFile(sRootPath, sFile, sPathBuffer) Then 'Strip off the null string that will be returned following the path name iEnd = InStr(1, sPathBuffer, vbNullChar, vbTextCompare) sPathBuffer = Left$(sPathBuffer, iEnd - 1) FindFile = sPathBuffer Else FindFile = vbNullString End If End Function
Orijinal Yorumlar (3)
Wayback Machine'den kurtarıldı