本帖最后由 hejoy91 于 2011-05-18 13:58:04 编辑

解决方案 »

  1.   

    procedure Stealfriends.execute;
    begin
      Synchronize(xx);
    end;procedure stealfriends.xx;
    var
    begin
    //写入事件
      end;
    end;
      

  2.   

    楼上的两位 我不太懂你们的意思,因为onExecute的方法本来就是主线程的 但是不知道为什么他每次执行完都可以再调用,我也试着用althread.synchronize来调用 但是会显示[Error] Main.pas(281): There is no overloaded version of 'Synchronize' that can be called with these arguments
    这个错误,但是他有
    procedure Synchronize(Method: TThreadMethod); overload;
    procedure Synchronize(Method: TMethod); overload;
    这两个方法,第一个参数就是过程的,为什么找不到匹配的呢,郁闷
      

  3.   

    procedure althread.execute;
    begin
      ms:='我在唱歌';
      Synchronize(xx);
      ms:='我在跳舞';
      Synchronize(xxb);
    end;procedure althread.xx;
    begin
       memo1.text:=ms;
       end;
    end;
    procedure althread.xxb;
    begin
       memo2.text:=ms;
       end;
    end;
      

  4.   

    bug你说的那个我懂,我也知道怎么用synchronize这个方法,但是目前我想在tcpserver的onExecute方法中创建一个新form,但是不知道如何下手,你这样重新althread不可取,因为他是只读的。
      

  5.   

    为什么要在线程里新FORM  不懂,睡觉去了
      

  6.   

    例如AThread.Synchronize(newForm); 其中newform是个procedure
    我点进去synchronize是
    procedure Synchronize(Method: TThreadMethod); overload;
    procedure Synchronize(Method: TMethod); overload;
    其中TThreadMethod = procedure of object;
    那我运行AThread.Synchronize(newForm)的时候为什么还报[Error] Main.pas(281): There is no overloaded version of 'Synchronize' that can be called with these arguments 这个错误,求解
      

  7.   

    补上一下。TThreadMethod = procedure of object; 这种类型的参数 不是procedure吗?
      

  8.   

    把newform定义到类里面就可以用synchronize(newform)来调用了,但是这种参数传递也是个问题,基本的问题已经解决了,谢谢大家