BBC BASIC for Windows
Programming >> Database and Files >> FILESEARCH
http://bb4w.conforums.com/index.cgi?board=database&action=display&num=1243139408
FILESEARCH
Post by Michael Hutton on May 24th, 2009, 04:30am
While pondering on PROFILER.... I have written a library which will open a dialogue box and perform a recursive file search for you. (The original FNfsearch() routine by RTR). When a specific file is found the WIN32_FIND_DATA structure for that file is sent to a PROC that the user has specified (see PROC_FileSearch(PROC_FileFound()) and PROC_FileFound() in FILESEARCH DEMO). This removes the neccesity of customising the FN_fsearch routine every time you need to do a file search. You only need to update the PROC_FileFound() procedure.
Try out the demo at:
http://tech.groups.yahoo.com/group/bb4w/files/%22Temp%20Folder%22/MDCH/FILESEARCH/FILESEARCH%20DEMO.bbc
making sure you have FILESEARCH in your @lib$ folder.
http://tech.groups.yahoo.com/group/bb4w/files/%22Temp%20Folder%22/MDCH/FILESEARCH/FILESEARCH.bbc
When using it remember the procedure you name when calling PROC_FileSearch must have a pair of parenthesis so:
PROC_FileSearch(PROC_FileFound()) is correct
whereas:
PROC_FileSearch(PROC_FileFound)
will cause an error.
The parameters passed are (index%, WIN32_FIND_DATA{}) so make sure your procedure (PROC_FileFound() in this case) receives two parameters.....
Michael
Re: FILESEARCH
Post by Michael Hutton on May 26th, 2009, 05:24am
I've added to :
1. You can fill a FILESEARCH_OPTIONS{} which will allow the programmer to do a user initiated file search (ie opens a dialog box) or a programmer initiate file search.
2. The WIN32_FIND_DATA{} is now converted to a BBCBASIC_FILE_DATA{} of my own design which makes it easier to extract the information you want. See the FILESEARCH DEMO (now a standalone version which should run straight from the website).
The advantage of using this library is that you can customise your search from within the PROC you name.
Michael