delphi多线程

//---------------------------
//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=', '&amp');
   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(); //调用

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值