//---------------------------
//public |
// { Public declarations } |
//end; |
//---------------------------
TMyThread = class(TThread)
private
public
procedure listb;
constructor Create();
procedure Execute; override;
end;
//--------------------
{$R *.dfm} |
//--------------------
constructor TMyThread.Create();
begin
inherited Create(false);
end;
procedure TMyThread.listb(); //多线程子过程
var
strid,IDma,strname,strdate,strData4,strData5:String;
//StrStream:TStringStream;
s1:Tstringlist;
i:integer;
begin
li7:=''; Form1.ComboBox2.Clear;
s1:=Split(daima,'<td class="pls" rowspan="2">');
for i:=1 to s1.Count-1 do
begin
strData4:='';
if i<5 then strid := quzhi(s1[i], 'false;">','</a>') else strid :=quzhi(s1[i], 'false;"><em>','</em>') ;
strname := quzhi(s1[i],'class="xw1">','</a>');
strdate := quzhi(s1[i], '发表于', '</em>');
strData4 :=quzhi(s1[i], '<table cellspacing="0" cellpadding="0">','class="cm"');
strData4 :=Rehtml(strData4);
IDma:=quzhi(s1[i], 'pid=', '&');
Form1.ComboBox2.Items.Add('['+strid+']楼,'+IDma+'|');
if Pos('<h3 class="psth xs1">点评</h3>',s1[i])<>0 then strData5:=ExtractEmails(s1[i],'<div class="pstl xs1">.*?</span>') else strData5:='' ;//0000ff 蓝颜色 6699FF
if i=1 then
li7 :=li7+ '<font color=#F000ff>[' + strid + '楼]</font>┋' + strname + '┋' + strdate+'┋' +'<a href="'+ urlQ+'" target="_blank">进入链接</a><br />'+ strData4 +'<br />'+strData5 +'<br />'
else
li7 :=li7+ '<font color=#F000ff>[' + strid + '楼]</font>┋' + strname + '┋' + strdate+'<br />'+ strData4 +'<br />'+strData5 +'<br />';
end;
li7 :='<html>'+#13#10+'<head>'+#13#10+'<script type="text/javascript">'+#13#10+form1.memo1.text+#13#10+'</head><body>'+li7+'</body></html>';
try
WriteHTML(Form1.WebBrowser1,li7);
finally
s1.Free ; daima:='' ;
end;
end;
procedure TMyThread.Execute;//多线程调用过程
begin
try
EnterCriticalSection(CS);
CoInitialize(nil);
daima:='';
daima:=cgetHtml(urlQ,'');//listview1.selected.caption');
Synchronize(listb);
finally
CoUninitialize();
LeaveCriticalSection(CS);
end;
end;
TMythread.Create(); //调用