Class TFileFind (unit DFileFin)

Inherits from

TComponent

Renamed from FileFind.pas 6/16/1998 Paul Rice to avoid conflicts with others' work. File Finder V1.00 - released June 10, 1998 Copyright(c) 1998 by Demian Disclaimer: This component is distributed as Freeware. There is no charge or warranty whatsoever. The author will not be held responsible for any direct or indirect damage resulting from the use of the component or any derivatives thereof. In short: USE IT AT YOUR OWN RISK! You are allowed to include the component code in any commercial or non commercial product. You are also allowed to make as many copies of the component as you want and distribute them, as long as you do not receive any money for the copying/distribution. You can send any comments, suggestions and bugs to demian@bhnet.com.br New versions can be found at: http://www.bhnet.com.br/~demian http://web.unix.horizontes.com.br/~demian If you do any modification to this code, please send me a copy. If you use this code on any 'real-life' application, please let me know. If you think this code is completely useless, please DON'T LET ME KNOW! What it does: A component to search for files in drives A to Z. Works both at design time and run time. Delphi 1/2/3 compatible. How to use it: 1. Install the component [VNM Pallete]; 2. Drop one TFileFind onto a form; 3. Enter file name to be searched into 'Search' property; 4. Set 'Enabled' property to True (this will start the search); 5. If the file is found its full path name is showed in 'Found' property. Properties: Enabled: boolean Set this property to True to start searching; set this property to False to stop searching (works both at design time and run time - see 'OnSearch' event below). Search: string File name with extension to be searched (no mask ? or mask * allowed). Found: string (read only) File name found (empty if not found). CurrentFile: string (read only - available at run time); Current file name being scanned (for progress display - see OnSearch event below). OnSearch: TNotifyEvent; Event triggered for every file name being scanned. Useful for progress display. For example, in a form with a TEdit component, enter the following code in 'OnSearch' event: procedure TForm1.FileFind1Search(Sender: TObject); begin edit1.text := TFileFind(Sender).CurrentFile; end; Final note: - This code is fully Delphi 1/2/3 compatible, so I avoided using TAnimate component or other version specific components. Also, to avoid the 'fat' overhead of Forms unit I created my own ProcessMessage procedure. If you prefer to use the Forms unit, change the line '{$IFDEF WIN32}Windows{$ELSE}WinProcs,WinTypes{$ENDIF};' to 'Forms;' and delete the 'procedure ProcessMessage' from this unit. - Any drive not available for immediate searching (networked disc drives or floppy disc drives) will be just skipped (no exception will be raised). - I did not implement mask searching ( ? and/or * ) because I don't need this feature right now (maybe in V1.01), but I'd be very pleased if some of you could implement it and send me the code.

Constructors



Functions

procedure SearchFile;

______________________________________________________________________________

procedure SetEnabled(const Value: boolean);

______________________________________________________________________________

procedure SetFound(const Value: string);

______________________________________________________________________________

procedure SetSearch(const Value: string);

______________________________________________________________________________

Properties

property Enabled : boolean


property Found : string


property Search : string


property CurrentFile : string


Events

event OnSearch : TNotifyEvent


Variables

FCurrentFile : string;


FEnabled : boolean;


FFound : string;


FOnSearch : TNotifyEvent;


FSearch : string;



Constructors


Functions


procedure SearchFile;

______________________________________________________________________________


procedure SetEnabled(const Value: boolean);

______________________________________________________________________________


procedure SetFound(const Value: string);

______________________________________________________________________________


procedure SetSearch(const Value: string);

______________________________________________________________________________


Properties


property Enabled : boolean


property Found : string


property Search : string


property CurrentFile : string


Events


event OnSearch : TNotifyEvent


Variables


FCurrentFile : string;


FEnabled : boolean;


FFound : string;


FOnSearch : TNotifyEvent;


FSearch : string;