Resplendent Filefind Component

for Delphi32 and C++ Builder

 

version 2.00, November 23rd 1998
(c) 1998 Resplendence Software Projects
email: info@resplendence.com
website: http://www.resplendence.com

LIMITATION OF LIABILITY:

IN NO EVENT SHALL WE BE LIABLE FOR ANY INCIDENTAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES WHATSOEVER ARISING OUT OF USE OF THE USE OF THE SOFTWARE. SOME STATES AND COUNTRIES DO NOT ALLOW EXCLUSION OR LIMITATION OF LIABILITY FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES, THEREFORE THE ABOVE LIMITATION MAY NOT APPLY TO YOU.

 

Description:

The Resplendent Filefind component is a simple but effective component that allows you to search specified paths and/or files for a text string using a separate thread.

The component allows you to limit a search to a set of files (or directories). This makes it possible to narrow a list of previously found matches by searching again on other criteria.

 

Distribution and licensing:

The component may be freely used and distributed as long as it will not be used for any commercial purpose. For commercial use, a special licensed version will have to be purchased.  Price: $39

hand.gif (1203 bytes)Click here to order online with your creditcard over a highly secure Verisign connection and download the registered product including a license for commercial use and the source code.

 

Installation:

Start Delphi2, Delphi3, Delphi4 or C++ Builder. Click Component, Install Component, Browse. Now point to the file RFilefind.PAS.
The component will appear on a tab called Resplendence.

Properties:

FileMask: String
A file specification mask specifying what files search for..
Example: RFilefind1.FileMask:='*.*';

 

Directories: TStringList Specifies what directory paths the component should search recursively. This may be UNC path names.

 

Files: TStringList
Specifies in what files to search. If this list is not empty then matches will only be found if the filename of the file can be found in this list. This is very useful if you want to limit your search to a set of files, for instance if you want to make another search on a list of found files.

 

ContaingText: String
If this string is not empty then matches will only be found if the specified string can be found in the file.
Example: Rfilefind1.ContaingText:='Borland';
will ensure that no files will be found that do not contain this text.

 

CaseSensitive: Boolean
Specifies whether or not to ignore the difference between uppercase and lowercase characters when performing a search with a specified searchstring in ContaingText.
Example: CaseSensitive:=FALSE will make any nodistinction between uppercase and lowercase text.

 

State: TSearchState Specifies what the component is currently doing. Values can be any of ssInitializing, ssRunning, ssPaused, ssStopped or ssCompleted.

 

ThreadPriority: TThreadPriority
Sets the priority level of the searching thread.
Example: RFileFind.ThreadPriority:=tpIdleTime;
will only allow the search to be executed when no other process is asking for any CPU time.
Version: String Specifies the current version of Resplendent Filefind Component.

 

Methods:

procedure Start; Starts the search. Before calling this method make sure that all properties (Drives, Directories, Files, ContaingText ...)
have been set. Setting properties after calling this method will have no result until Start is called again.
Example: RFileFind1.Start; // starts searching

 

procedure Pause;
Allows you to temporarily interrupt the search progress. After calling Continue the search will carry on.
Example: RFileFind1.Pause; // pauses the search in progress

 

procedure Stop;
Cancels a search that is in progress. After calling Stop, the
search can not be continued anymore.
Example: RFileFind1.Stop; // terminates the search in progress

 

procedure Continue; Allows you to continue the search after Pause has been called.
Example: RFileFind1.Continue; // continues the interrupted search

 

function GetFixedDrives: String; Returns all drives from which the disk cannot be removed in the system.

 

function GetRemoteDrives: String; Returns a string with the letters of all network drives found in the system.
For example: RFileFind1.Drives:=GetRemoteDrives;
will ensure that no search is performed on non-network drives.

 

function GetRamDrives: String; Returns all RAM disks found in the system.

 

function GetRemovableDrives: String; Returns all removable drives found in the system.

 

function GetCDRomDrives: String; Returns all CDRom drives found in the system.

 

 

 

Events:

OnFileFound;

procedure(Sender:TObject; directory: String; fileinfo: TSearchRec);

Event that occurs as soon as a file is found that matches all specifications
in FileMask,Drives,Directories,Paths in the case no search is made for a text string (and ContaingText.is empty).
In directory is specified the filepath of the file.

Fileinfo is of the type TSearchRec and stores information on the
file that was found, like the filename:

TSearchRec = record
        Time: Integer; // specifies file time
        Size: Integer; // specifies file size
        Attr: Integer; // specifies attributes
        Name: TFileName; // file is of type String
        ExcludeAttr: Integer; //
        FindHandle: THandle; //
        FindData: TWin32FindData; // eventually more info

See Delphi Help on TSearchRec type for more information.

OnTextFound;

procedure(Sender:TObject; directory: String; fileinfo: TSearchRec; offset: Integer; var processNextMatch: Boolean);

Occurs when a string has been found in a file.

fileinfo contains information on the file. Offset contains the offset in the file where the string has been found. You can skip anymore matches in the file by setting processNextMatch to FALSE.

OnCompleted;

procedure(Sender:TObject);

Event that occurs as soon as the search has finished and completed
normally.
property OnChangeDirectory:

procedure(Sender:TObject; directory: String);

Event that occurs during the search process when a new directory
is being scanned. Directory contains the path being scanned.
OnAccessDenied;

procedure(Sender:TObject; directory: String; fileinfo: TSearchRec);

 

Occurs when an attempt has been made to scan the file for text and the file could not be opened.
OnStartScanning;

procedure(Sender:TObject; directory: String; fileinfo: TSearchRec; var AllowScanning: Boolean);

Occurs before a file is being opened to be scanned for text (and ContainingText is not an empty string). By setting AllowScanning to FALSE you can skip the file from being scanned.