📄 unit1.~pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdHTTP, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
Button2: TButton;
Label1: TLabel;
Label2: TLabel;
Memo2: TMemo;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Memo1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
var
sou: TSouSuo;
str1: string= '共搜到%d个号码';
procedure TForm1.Button1Click(Sender: TObject);
begin
if Trim(Memo2.Text) = '' then
begin
Application.MessageBox(PAnsiChar('搜索条件不能为空'), '',MB_OK);
Exit;
end;
Button1.Enabled := False;
Button2.Enabled := True;
sou := TSouSuo.Create(false);
sou.Priority := tpHigher;
sou.FreeOnTerminate := True;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Button1.Enabled := True;
Button2.Enabled := False;
if sou <> nil then
begin
terminatethread(sou.Handle, 0);
Application.MessageBox(PAnsiChar('搜索被停止'), '',MB_OK);
end;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if sou <> nil then
begin
terminatethread(sou.Handle, 0);
end;
end;
procedure TForm1.Memo1Change(Sender: TObject);
begin
Label1.Caption := Format(str1,[Memo1.Lines.Count]);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -