什么意思搞不明白,是不是象下面一样?
 
TMyThread = class(TThread)
  private
    child : TForm;
    childform : TForm;
  public
    procedure draw;
    constructor Create(parent : TForm);
    destructor Destroy;
    procedure Execute; override;  end;
constructor TMyThread.Create(parent: TForm);
begin
  child := parent;
  inherited Create(false);
end;destructor TMyThread.Destroy;
begin
  if Assigned(childform) then
   FreeAndNil(childform);
end;procedure TMyThread.draw;
  var i:integer;
begin
  begin
    childform := TForm.Create(nil);
    childform.Caption := 'OK';
    childform.Parent := child;
    childform.Show;
  end;
end;
procedure TMyThread.Execute;
begin
  inherited;
  synchronize(draw);
  if Terminated then Exit;
end;procedure TForm1.Button1Click(Sender: TObject);begin
  TMythread.Create(Form1);
end;

解决方案 »

  1.   

    不是楼上的说的那样!
    是:procedure TMyThread.Execute;
    begin
       while not Terminated do
       begin
             try
          MyExcel:=CreateOleObject('Excel.application');
       except
          showmessage('error!');
       end;
    end;
    end;
      

  2.   

    to coldsnake(coldsnake) 
    能讲的清楚点吗?
    老实说我对线程不是很了解,有谁能帮帮我吗?
      

  3.   

    问题是,我用线程调用dll可以实现,如果直接在线程里实现就会报错!为什么?哪位大虾明白?