线程代码unit Unit2;interfaceuses
  SysUtils,
  Classes,IdGlobal;type
  TTestThread = class(TThread)
  private  protected
    procedure Execute; override;  public
  end;implementationprocedure TTestThread.Execute;
begin
  FreeOnTerminate := True ;
  raise Exception.Create('bbbbbbbbbaaaaa');
end;end.在主程序调用
var
  vThread : TTestThread;
begin
    vThread :=  TTestThread.Create(True) ;
    vThread.Resume;编译执行,不会报出错误,被屏蔽

解决方案 »

  1.   

    //我测试可以阿,delphi 7,xp下
    unit MainThread;interface
    uses  Classes,Windows,activeX,Comobj,SysUtils;
    type
      TTestThread = class(TThread)
        private
        protected
          procedure execute;override;
        public
          constructor create;  end;implementation{ TTestThread }constructor TTestThread.create;
    begin
      inherited create(false);
      FreeOnTerminate:=true;
    end;procedure TTestThread.execute;
    begin
      raise Exception.Create('bbbbbbbbbaaaaa');
    end;end.
    //主界面调用代码
    private
        t:ttestThread;
    //命令按钮下代码
      t:=ttestthread.create;
    //能够报出异常来
      

  2.   

    你不要在调试环境下试试,直接执行Exe ,我是在delphi 6 下试的
    执行都没有反映
      

  3.   

    没用到界面,只是想问一下,在多线程里怎么才能把错误 raise 出去
    在主窗体里能报这个错误
      

  4.   

    DEMO