procedure TForm1.pp; 
var
  paralist:Tstringlist ;
  s1:TStringStream ;
begin
  paralist := Tstringlist.Create ;
  s1 := TStringStream.Create('');
  PARALIST.ADD('na=user') ;
  PARALIST.ADD('pass=pass') ;
  PARALIST.ADD('ac=edit') ;
  PARALIST.ADD('id=54') ;
  form1.IdHTTP1.Request.Referer := 'http://www.xxxxxxx.com/index.html' ;
  try
    idhttp1.Post('http://www.xxxxxxx.com/edit.asp', paralist, s1) ;
  finally
    paralist.Free ;
    s1.Free ;
  end;
end;哪位大哥帮我把这个过程,改为线程来执行呀?

解决方案 »

  1.   

    private
       procedure run;///////
    procedure run;
    begin
      form1.IdHTTP1.Request.Referer := 'http://www.xxxxxxx.com/index.html' ;
        idhttp1.Post('http://www.xxxxxxx.com/edit.asp', paralist, s1) ;
    end;
    var
      paralist:Tstringlist ;
      s1:TStringStream ;
    procedure TSendTread.Execute;
    begin
      paralist := Tstringlist.Create ;
      s1 := TStringStream.Create('');  
      PARALIST.ADD('na=user') ;
      PARALIST.ADD('pass=pass') ;
      PARALIST.ADD('ac=edit') ;
      PARALIST.ADD('id=54') ;
      Synchronize(run);
    end;
      

  2.   

    大哥,还是看不懂呀....我现在的程序调用时是用TIMER调用PP的.
    不会用哟..
      

  3.   

    unit Unit_FrmMain;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms;type
      TMyThread = class(TThread)
      private
        procedure pp;
      protected
        procedure Execute; override;
      end;  TFrmMain = class(TForm)
        MainMenu1: TMainMenu;
    ...
    var
      FrmMain: TFrmMain;implementation
    ...
    ...{ TInitThread }procedure TMyThread.pp;
    var
      paralist:Tstringlist ;
      s1:TStringStream ;
    begin
      paralist := Tstringlist.Create ;
      s1 := TStringStream.Create('');
      PARALIST.ADD('na=user') ;
      PARALIST.ADD('pass=pass') ;
      PARALIST.ADD('ac=edit') ;
      PARALIST.ADD('id=54') ;
      form1.IdHTTP1.Request.Referer := 'http://www.xxxxxxx.com/index.html' ;
      try
        idhttp1.Post('http://www.xxxxxxx.com/edit.asp', paralist, s1) ;
      finally
        paralist.Free ;
        s1.Free ;
      end;
    end;
    procedure TInitThread.Execute;
    begin
      FreeOnTermiNate:=True;
      Synchronize(PP);
    end;...
    end.
      

  4.   

    贴错了:
    unit Unit_FrmMain;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms;type
      TMyThread = class(TThread)
      private
        procedure pp;
      protected
        procedure Execute; override;
      end;  TFrmMain = class(TForm)
        MainMenu1: TMainMenu;
    ...
    var
      FrmMain: TFrmMain;implementation
    ...
    ...{ TMyThread }procedure TMyThread.pp;
    var
      paralist:Tstringlist ;
      s1:TStringStream ;
    begin
      paralist := Tstringlist.Create ;
      s1 := TStringStream.Create('');
      PARALIST.ADD('na=user') ;
      PARALIST.ADD('pass=pass') ;
      PARALIST.ADD('ac=edit') ;
      PARALIST.ADD('id=54') ;
      form1.IdHTTP1.Request.Referer := 'http://www.xxxxxxx.com/index.html' ;
      try
        idhttp1.Post('http://www.xxxxxxx.com/edit.asp', paralist, s1) ;
      finally
        paralist.Free ;
        s1.Free ;
      end;
    end;
    procedure TMyThread.Execute;
    begin
      FreeOnTermiNate:=True;
      Synchronize(PP);
    end;...
    end.
      

  5.   

    写你的处理到线程函数,然后调用beginthread
      

  6.   

    呵呵,这个太简单了吧。
    type TPPThread=class(TThread)
    protected
      procedure pp;
    public
      procedure Execute;override;
    end;procedure TPPThread.Execute;
    begin
      while not Terminated do
      begin
        Synchronize(pp);
        Sleep(100);
      end;
    end;procedure TPPThread.pp;
    begin
      Form1.pp;
    end;
      

  7.   

    谁能帮我写成一个DEOM程序呀????
      

  8.   

    delphi里有 Threads的 例子..
      

  9.   

    谁能帮我写成一个DEOM程序呀????我付费行不行,有好人加我的QQ吗/
      

  10.   

    wizardqi(男巫) ( )的代码已经很明白了啊。type TPPThread=class(TThread)
    protected
      procedure pp; //改成 pp:TThreadMethod更好, 这样就通用了。
    public
      procedure Execute;override;
    end;