Unit JAFilFnd

Classes

TFileSearch -

Functions

Register -

Types

TChangeFolderEvent
TFindFileEvent

Constants

Variables


Functions


procedure Register;


Types


TChangeFolderEvent = procedure(fullpath:string;info:TSearchRec)of object

TFindFileEvent = procedure(fullpath:string;info:TSearchRec)of object
This component performs file search with or without recursing subfolders, with events generated on file match and on change scanning folder. Written in Delphi3, but I suppose it will work on Delphi1 and Delphi2 also Version 1.0 // following 3 Additions by David R Hazlehurst 4/6/98 (drarh@tcp.co.uk) TStringList to store list of files found. (called "FilesFound") Support for multiple wildcards in the one search. (SearchFile property) Added flag to indicate if searching already or not. Properties: property Stop : boolean - Set to true if you want to cancel searching. property SearchFile : shortstring - Set starting path and file mask for searching (e.g. "c:\*.doc"). property RecurseSubFolders : boolean - Do recursing or not. property FilesFound : TStringList - drh : list of files found (read only) property Searching : boolean - drh : Indicates if a search is in progress (read only) Event handlers: property OnFileFind : TFindFileEvent - On match found property OnChangeFolder : TChangeFolderEvent - On change folder property OnFinish : TNotifyEvent - On end of searching Methods: procedure Start; - Start searching. This component is freeware. I guarantee you nothing concering this code, but you can use it as you wish. Happy coding This component is dedicated to the girl I love... B. Jem Naadi Ahmed Bulsoft Bulgaria 25 May, 1998 jemna@yahoo.com Any comments will be welcome. ///////////////////////////////////////////////////////////////////////////// // Following changes by David R Hazlehurst (drarh@tcp.co.uk) 4th June 1998 ///////////////////////////////////////////////////////////////////////////// Reformatted some of the layout to suit my style (indents, tabs, spacing, etc). Create contructor moved to "public" block of type def. Added property to store list of files found ("FilesFound"). This makes it easier for the user of the control to get the list info. Added code to create string list in contructor Added destructor event to handle destruction of string list created within the create event Added a public "Searching" flag to indicate if search is already underway. This will not prevent you from calling "start" again, but does provide a means of checking to see if the user already started searching. You can then decide if you want to start a new search. Another reason for making this optional rather than stopping you from searching outright, is in case an error occurs while searching and you may not get past the search block. Of course, you can add a block to the code if you really want it. Improved the "start" procedure as follows: the "SearchFile" parameter can now accept multiple wildcards to search for more than one file type. Each wildcard is sepearted by ";" as per the shell. Each type is searched in order given. So, for example: SearchFile := 'c:\*.bat;*.sys' could return "c:\autoexec.bat" and "c:\config.sys", as well as others. end of my list. Im not claiming ideal solutions here, they were just the first things that occurred to me (from my requirements), and hey, they work. By all means, improve on my "improvements" if you wish. I would also be interested in the results. /////////////////////////////////////////////////////////////////////////////

Constants


Variables