.dpr源码是: program webDownP;uses Forms, webDown in 'webDown.pas' {Form1}, RegCode in 'RegCode.pas' {FrmReg}, Global in 'Global.pas';{$R *.res}begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.CreateForm(TFrmReg, FrmReg); Application.Run; end.
你再猜猜当你执行那段代码的时候,FrmReg已经创建了没有 改成这样:program webDownP; uses Forms, webDown in 'webDown.pas' {Form1}, RegCode in 'RegCode.pas' {FrmReg}, Global in 'Global.pas'; {$R *.res} begin Application.Initialize; FrmReg := TFrmReg.Create(Application); Application.CreateForm(TForm1, Form1); Application.Run; end.
刚扔了一个窗体,在它建立之前调用Show,出错的地址就是02f4,访问的是TCustomForm(nil).FFormState
program webDownP;uses
Forms,
webDown in 'webDown.pas' {Form1},
RegCode in 'RegCode.pas' {FrmReg},
Global in 'Global.pas';{$R *.res}begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TFrmReg, FrmReg);
Application.Run;
end.
改成这样:program webDownP; uses
Forms,
webDown in 'webDown.pas' {Form1},
RegCode in 'RegCode.pas' {FrmReg},
Global in 'Global.pas'; {$R *.res} begin
Application.Initialize;
FrmReg := TFrmReg.Create(Application);
Application.CreateForm(TForm1, Form1);
Application.Run;
end.