home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Programming Unleashed
/
Delphi_Programming_Unleashed_SAMS_Publishing_1995.iso
/
chap30
/
findallw
/
main.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1995-03-20
|
1KB
|
66 lines
unit Main;
{ Program copyright (c) 1995 by Charles Calvert }
{ Project Name: FINDALLW }
{ Use this program to iterate through the directories
on your hard drive and search for files. Enter
the path where you want to start searching, with
no backslash at the end, and then enter the mask
that you want to search with, for instance '*.pas'.
}
interface
uses
WinTypes, WinProcs, Classes,
Graphics, Forms, Controls,
AllDirs, StdCtrls, Fileiter;
type
TForm1 = class(TForm)
BStartSearch: TButton;
ListBox1: TListBox;
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
Label2: TLabel;
FileIterator1: TFileIterator;
procedure BStartSearchClick(Sender: TObject);
private
procedure FoundFile(FileName: String);
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses
SysUtils;
{$R *.DFM}
procedure TForm1.FoundFile(FileName: String);
begin
Edit1.Text := FileName;
end;
{ Make sure the FILEITERATOR's UseFileList property
is set to true! }
procedure TForm1.BStartSearchClick(Sender: TObject);
var
RunDir, Start: String;
begin
Start := Edit1.Text;
RunDir := Edit2.Text;
ListBox1.Clear;
FileIterator1.Run(Start, RunDir);
ListBox1.Items := FileIterator1.FileList;
end;
end.