Locate executable file ? 
Author Message
 Locate executable file ?

Hi,

I am writing a program using VB6 that will read a default location from
the users registry for an installed file, and will attempt to execute
it. If it doesn't find the file there, what is the best way to have it
search the user's hard drive to find the file. Should I use an API call,
or use the filesystemobject ? Most search functions only search the
current directory.

Any advice appreciated.

Thanks,
Richard



Sat, 17 Nov 2001 03:00:00 GMT  
 Locate executable file ?

Quote:
> I am writing a program using VB6 that will read a default location from
> the users registry for an installed file, and will attempt to execute
> it. If it doesn't find the file there, what is the best way to have it
> search the user's hard drive to find the file. Should I use an API call,
> or use the filesystemobject ? Most search functions only search the
> current directory.

Just an option, but in an app I recently contracted on, we:

1) Checked for a file under the application directory (where it should have
been installed).
2) If that failed, we looked to a registry entry for an "override" folder,
in case the user moved the file.
3) Failing that, we then simply popped up a "Locate File" dialog
(essentially a File Open dialog), and asked the user to locate it.  That
location was then written to the registry as an "override" location.

I guess it depends on whether this is most likely a rare occurrence, or you
expect it to happen often.  If the file will be located once, and then
should remain relatively static at that location, the "find it yourself <g>"
dialog might be acceptable.  If this is not the case, then yes, you'll have
to search the drive.  But, what if the user has multiple hard drives?  Or,
what if the app is available on a network drive?  Do you now search the
entire network?  This could obviously be taken to extremes, but  I think if
you check the obvious places and then check for a "user-defined place" (as
noted in the registry, for example) and you still don't find it, then it
might be acceptable to let the user locate it.

I realize it's nice to do the work for them, but your time may be better
spent writing an enhancement or fixing a bug that would benefit the majority
of the users on a daily basis, as opposed to writing code to handle the "1%
case".  It really depends on your audience and how often this will occur.

Also, MS had published a "DirWalk" example, that traverses a directory tree
(so you could always start at the root), and walks through the directories
under it.  You could use this code read locate the app if you decide to do
the work for them.   I think it was available on the MS VB Owner's Area (if
I remember).  If you need it and can't find it, I might have it on my hard
drive...

Good Luck,

--
Vinnie Murdico
Software with Brains, Inc.
http://www.softwarewithbrains.com



Sat, 17 Nov 2001 03:00:00 GMT  
 Locate executable file ?
Hi Vinnie,

Thanks for the response, that was a great answer. One question about the
"override" folder. How does the entry for the location of the override folder
get put into the registry. Is it a custom entry for that user that you put there
(I already have a default location specified in the registry), or is it only
created in the case you mentioned where the user searches for the file
themselves ?

Thanks,
Richard

Quote:
> Just an option, but in an app I recently contracted on, we:

> 1) Checked for a file under the application directory (where it should have
> been installed).
> 2) If that failed, we looked to a registry entry for an "override" folder,
> in case the user moved the file.



Sun, 18 Nov 2001 03:00:00 GMT  
 Locate executable file ?

Quote:
> Also, MS had published a "DirWalk" example, that traverses a directory tree
> (so you could always start at the root), and walks through the directories
> under it.  You could use this code read locate the app if you decide to do
> the work for them.   I think it was available on the MS VB Owner's Area (if
> I remember).  If you need it and can't find it, I might have it on my hard
> drive...

Hi Vinnie,

Can you let me know if you have this code ? I have tried to find it through the
MSDN library, but that thing is a nightmare to find stuff in.

Thanks,
Richard



Mon, 19 Nov 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Converting BASIC files into EXEcutable files

2. '.MAK' files into executable files

3. merging fortran executable with a VB executable

4. Shrinking Windows executables and Stand-alone VB executables

5. Locating an external file

6. User Preferences located in a seperate file

7. Openining a PowerPoint file located in folder with a name containing spaces

8. Locating specific file with word macro

9. Locating pointers for files included in documents

10. locate a file

11. Returning properties for file located on remote web server

12. How to read files which locate network drive ?

 

 
Powered by phpBB® Forum Software