实在不知道为什么,就在myThread.creat就抛出不能访问的异常,如果把myThread的声明放在
procedure TForm1.Button1Click(Sender: TObject);里就在mythread.resume里异常,请高手指点是为什么呢?
unit useDispThread;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, TDispThr, StdCtrls;type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
{ Private declarations }
public
{ Public declarations }
  end;var
Form1: TForm1;
myThread: TDispThread;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
myThread.Create( false );
myThread.FreeOnTerminate := true;
end;end.