Below is the code:
The unit Unit1;
Interface
USES the
Winapi. Windows, Winapi Messages, System. SysUtils, System. Variants, System. Classes, Vcl. Graphics,
The Vcl. Controls, Vcl. Forms, Vcl. Dialogs, Vcl. StdCtrls, Vcl. Buttons, Vcl. FileCtrl,
Vcl.Com Ctrls, Vcl. Menus, dxGDIPlusClasses, Vcl. ExtCtrls;
Type
TForm1=class (TForm)
DirectoryListBox1: TDirectoryListBox;
DriveComboBox1: TDriveComboBox;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Edit3: TEdit;
BitBtn3: TBitBtn;
StatusBar1: TStatusBar;
RichEdit1: TRichEdit;
CheckBox1: TCheckBox;
Returns: TBitBtn;
Image1: TImage;
Label2: TLabel;
Selected to open the file: TBitBtn;
BitBtn5: TBitBtn;
ReplaceDialog1: TReplaceDialog;
Procedure BitBtn2Click (Sender: TObject);
Procedure DirectoryListBox1MouseUp (Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
Procedure BitBtn1Click (Sender: TObject);
Procedure BitBtn3Click (Sender: TObject);
Procedure FormCreate (Sender: TObject);
Procedure FormKeyDown (Sender: TObject; Var Key Word; Shift: TShiftState);
Procedure RichEdit1Click (Sender: TObject);
Procedure to return the Click (Sender: TObject);
Procedure FormMouseWheel (Sender: TObject; Shift: TShiftState;
WheelDelta: Integer; MousePos: TPoint; Var Handled: Boolean);
Procedure selected to open the file Click (Sender: TObject);
Procedure BitBtn5Click (Sender: TObject);
Procedure ReplaceDialog1Replace (Sender: TObject);
Procedure ReplaceDialog1Find (Sender: TObject);
Private
{Private declarations}
Public
{Public declarations}
end;
Var
Form1: TForm1;
S, b: string;
A, c: integer;
Implementation
{$R *. DFM}
The function searchfile (path: string) : TStringList;
Var
SearchRec: TSearchRec;
Found: integer;
The list: TStringList;
The begin
List:=TStringList. Create;
Found:=FindFirst (path + '\ *. Pas', faAnyFile, SearchRec);
While the found=0 do
The begin
If (SearchRec. Name<> '. ') and (SearchRec. Name<> '.. ') and (SearchRec. Attr<> Then faDirectory)
List. The Add (SearchRec. Name);
Found:=FindNext (SearchRec);
end;
FindClose (SearchRec);
Searchfile:=list;
end;
Procedure TForm1. BitBtn1Click (Sender: TObject);
The begin
RichEdit1. Lines. The Clear;
RichEdit1. Lines. AddStrings (SearchFile (DirectoryListBox1 GetItemPath (DirectoryListBox1. ItemIndex)));
end;
Procedure TForm1. BitBtn2Click (Sender: TObject);
The begin
If MessageBox (handle, 'sure you want to shut down the program,' close the window, MB_OKCANCEL)=IDOK then
close;
end;
Procedure TForm1. BitBtn3Click (Sender: TObject);
Var
I, j: integer;
S1, s2: string;
The begin
If checkbox1. Checked=true then
The begin
RichEdit1. Lines. LoadFromFile (DirectoryListBox1 GetItemPath (DirectoryListBox1. ItemIndex) + '\' + b);
RichEdit1. Text:=AnsiLowerCase (RichEdit1. Text);
ReplaceDialog1. FindText:=AnsiLowerCase (ReplaceDialog1 findText);
end;
If checkbox1. Checked=false then
RichEdit1. Lines. LoadFromFile (DirectoryListBox1 GetItemPath (DirectoryListBox1. ItemIndex) + '\' + b);
i:=0;
S1:=ReplaceDialog1. FindText;
S2:=RichEdit1. Text;
While pos (s1, s2) & gt; 0 do
The begin
S2:=copy (s2, pos (s1, s2) + 1, length (RichEdit1. Text));
Inc (I);
end;
Edit3. Text:=inttostr (I);
If I=0 then
Showmessage (' can't find your search words!!!! ');
end;
Procedure TForm1. BitBtn5Click (Sender: TObject);
The begin
ReplaceDialog1. Execute;
end;
Procedure TForm1. Open the file selected Click (Sender: TObject);
The begin
B:=richedit1. Lines. Strings [a];
If a
end;
Procedure TForm1. Return to Click (Sender: TObject);
The begin
RichEdit1. Lines. The Clear;
RichEdit1. Lines. AddStrings (SearchFile (DirectoryListBox1 GetItemPath (DirectoryListBox1. ItemIndex)));
end;
Procedure TForm1. DirectoryListBox1MouseUp (Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
The begin
DirectoryListBox1. GetItemPath (DirectoryListBox1. ItemIndex);
end;
Procedure TForm1. FormCreate (Sender: TObject);
The begin
RichEdit1. The Clear;
Edit3. Text:=inttostr (0);
end;
Procedure TForm1. FormKeyDown (Sender: TObject; Var Key Word;
Shift: TShiftState);
The begin
If the key=VK_F3 then
ReplaceDialog1Find (Sender);
end;
Procedure TForm1. FormMouseWheel (Sender: TObject; Shift: TShiftState;
WheelDelta: Integer; MousePos: TPoint; Var Handled: Boolean);
The begin
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull