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


本文整理自网络,侵删。

 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.

相关阅读 >>

Delphi 删除只读文件

Delphi解析json格式化的日期

Delphi idhttp returning http 1.1/500 显示错误内容

Delphi获取网卡mac地址多个方法

Delphi 2010/xe下隐藏程序在系统任务栏的图标

Delphi 远程屏幕抓取的源代码

Delphi实现文件下载的几种方法

Delphi 启动程序隐藏主窗体

Delphi中根据程序名称判断是否多开

Delphi 利用datasnap进行数据流(tstream)的传递

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...