如题,最好大家能给一个例子!谢谢!!
解决方案 »
- 怎样向Visual Foxpro写的程序发送消息?重谢!!!
- 关于ADOquery的问题
- 怎么写函数?
- ■■■极简单的拖放问题■■■
- 怎样用DELPHI 和 ORACLE的存储过程返回记录集
- 求教dll 动态事件传递问题
- 我动态建立一个按钮,然后定义其onclick=showff(1), showff定义如下:
- 请问如何用ADO实现数据库的多线程编程
- 是不是DELPHI的BUG,我后台数据库用的是PARDOX7,在IDE下运行正常,打包后到别的机器上,打开一个表后修改在保存的时候运行就出现“不能修改一个关毕的数据库”错误,请问是什么原因!
- 还是这个弱智的问题,怎样把数据库中字段的值给LABLE1.CAPTION.答对就给分(头一次感到自己这么财大气粗)
- Report Machine 的 Count函数怎么不好用?
- 再找话题再3分
#########线程###########
type
TWebThread = class(TThread)
private
webbrowser:TWebBrowser;
number:integer;
Fminnum,Fmaxnum:integer;
Fhost:string;
protected
procedure Execute; override;
procedure WebBrowserDocumentComplete(Sender: TObject;const pDisp: IDispatch; var URL: OleVariant);
function seturl:string;
public
published
constructor Create(minnum,maxnum:integer);
destructor Destroy; override;
end;
implementation
uses unit1;
constructor twebthread.Create(minnum,maxnum:integer);
begin
inherited Create(True);
FreeOnTerminate:=true;
Fminnum:=minnum;
Fmaxnum:=maxnum;
Suspended:=False; end;
destructor TwebThread.Destroy;
begin
CoUninitialize;
inherited destroy;
end;
procedure TWebThread.Execute;
begin
try
CoInitialize(nil);
webbrowser:=TWebbrowser.Create(nil);
Fhost:=seturl;
form1.memo2.text:=form1.memo2.text+fhost;
webbrowser.Navigate(Fhost);
webbrowser.OnDocumentComplete:=WebBrowserDocumentComplete;
while not Terminated do
Application.ProcessMessages;
finally
webbrowser.Free;
end;
end;
function TWebThread.seturl:string;
begin
url:='http://www.google.com.sg/search?q=+%22%E5%A8%B1%E4%B9%90%E5%A4%A7%E7%www.epic.com&hl=zh-CN&lr=&newwindow=1&as_qdr=all&start='+inttostr(Fminnum)+'&sa=N';
Fminnum:=Fminnum+10;
result:=url;
end;
procedure Twebthread.WebBrowserDocumentComplete(Sender: TObject;const pDisp: IDispatch; var URL: OleVariant);
var
doc:IHTMLDocument2;
all:IHTMLElementCollection;
len,i:integer;
item:OleVariant;
begin
if not webbrowser.busy then
begin
doc:=webbrowser.Document as IHTMLDocument2;
all:=doc.Get_Links;
len:=all.length;
for i:=0 to len-1 do
begin
item:=all.item(i,varempty);
if (pos('google',item)=0)and(pos('hl=zh-CN',item)=0)and(pos('article_',item)>0) then
form1.Memo1.Lines.Add(item);
end;
end;
end;
end.#######调用#####
procedure TForm1.Button7Click(Sender: TObject);
var
j:integer;
th:array[0..5] of twebthread;
begin
minnum:=strtoint(form1.Edit1.text) ;
maxnum:=strtoint(form1.Edit2.text);
for j:=0 to 3 do
begin
th[j]:=twebthread.Create(minnum,maxnum) ;
minnum:=minnum+10;
if minnum>=maxnum then
break;
end;
end;
http://developer.mozilla.org/en/docs/Download_Mozilla_Source_Code
HTTP协议也简单GET /文件路径 HTTP/1.1
Host: 主机名(xxxx.com)+两个回车(#13#10#13#10)
jiangsheng(蒋晟.Net)说的东西就是我要的
但是两个例子都是c的,看得晕啊,有delphi的吗?