帮我看看这个代码有错误吗? ( 积分: 50 )

  • 主题发起人 主题发起人 mh527
  • 开始时间 开始时间
M

mh527

Unregistered / Unconfirmed
GUEST, unregistred user!
感觉没错,可运行不起来,谢谢各位大哥了
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
myThread = class(TThread)
private
protected
procedure Execute;
override;
public
end;

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
theList:Tlist;
public
{ Public declarations }
end;

var
Form1: TForm1;
implementation
{$R *.dfm}
procedure myThread.Execute;
begin

end;
procedure TForm1.Button1Click(Sender: TObject);
begin
theList.add(myThread.create(False));
end;

end.
 
感觉没错,可运行不起来,谢谢各位大哥了
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
myThread = class(TThread)
private
protected
procedure Execute;
override;
public
end;

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
theList:Tlist;
public
{ Public declarations }
end;

var
Form1: TForm1;
implementation
{$R *.dfm}
procedure myThread.Execute;
begin

end;
procedure TForm1.Button1Click(Sender: TObject);
begin
theList.add(myThread.create(False));
end;

end.
 
你把声明放入public中,试一试
 
把出错代码贴出来
 
theList,myThread
没有初使化
 
把所有单元代码都显示出来
 
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TmyThread = class(TThread)
private
protected
procedure Execute;
override;
public
end;

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
implementation
{$R *.dfm}
{ myThread }
procedure TmyThread.Execute;
begin
inherited;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
myThread:TmyThread;
//theList:
begin
myThread.create(False);
mythread.Free;
end;

end.
 
后退
顶部