RSS订阅 | 匿名投稿
您的位置:网站首页 > 线程 > 正文

delphi最简单的多线程网页采集

作者:admin 来源:未知 日期:2010/5/9 15:48:58 人气: 标签:

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdHTTP;

type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

Function Getwebs:Integer;stdcall;
Var
myhttp: TIdhttp;
cc:string;
begin
myhttp:=Tidhttp.Create(nil);
myhttp.ReadTimeout := 30000;
try
cc := myhttp.Get(form1.Edit1.Text);
except
showmessage('出错!!');
end;
form1.Memo1.lines.Text :=cc;
myhttp.Free;
Result :=0;
end;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
ID: THandle;
begin
CreateThread(nil, 0, @Getwebs, nil, 0, ID);
end;

end.
读完这篇文章后,您心情如何?
0
0
0
0
0
0
0
0
本文网址: