VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

A Find File Procedure No Looping

carñal  (2 Submissions)   Files/File Controls/Input/Output   Visual Basic 3.0   Beginner   Wed 3rd February 2021

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.

Inputs
sFile: File name to find. sRootPath: Path to begin the search in

Assumes
I know of two limitations: 1. The api has a maximum path depth of 32 directories (this is documented). If a directory that the current user does not have access rights to resides in the directory that the search starts in the api call will fail without warning (this is NOT documented).

Returns
Returns the full file path if found otherwise returns null string

API Declarations
Declare Function SearchTreeForFile Lib "IMAGEHLP.DLL" (ByVal lpRootPath As String, ByVal lpInputName As String, ByVal lpOutputName As String) As Long

Rate A Find File Procedure No Looping (10(10 Vote))
A Find File Procedure No Looping.bas

A Find File Procedure No Looping Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters