unit1.~pas

来自「国产简体中文版专业通过Baidu.COM引擎快速搜集大量目标城市和行业的公司企业」· ~PAS 代码 · 共 80 行

~PAS
80
字号
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 + =
减小字号Ctrl + -
显示快捷键?