问个关于BPL的问题
unit Unit3;
public
{ Public declarations }
id:string;
end;
---------------------------------------------------
我把Unit3放到BPL中,现在想在Unit2中打开Unit3窗口,并给Unit3中的id赋值,打开Unit3窗口是这么写的:
procedure TForm2.RzDBGrid1DblClick(Sender: TObject);
begin
//Form3:=TForm3.Create(Self);
//Form3.id:=ADOQuery1.FieldByName('id').AsString;
//Form3.ShowModal;
GetForm('TForm3'); //调用BPL
end;
procedure TForm2.GetForm(f1:string);
var AClass: TPersistentClass;
PackageModule: HModule;
frmBPL: TForm;
AddFunc: PInteger;
id: string;
begin
PackageModule := LoadPackage('Package1.bpl');
if PackageModule <> 0 then
begin
AClass := GetClass(f1);
if AClass <> nil then
begin
frmBPL := TComponentClass(AClass).Create(self) as TForm;
//frmBPL.id:=ADOQuery1.FieldByName('id').AsString; //这里错误,[Error] Unit2.pas(49): Undeclared identifier: 'id'
frmBPL.ShowModal;
end;
end;
end;
frmBPL.ShowModal;这句可以打开Unit3窗口,只是上面一句错误,
先不要告诉我做成DLL,目前我只想在BPL的基础上做,怎么办?