A
agai
Unregistered / Unconfirmed
GUEST, unregistred user!
var
hPackage : HModule = 0;
implementation
{$R *.dfm}
procedure TfrmMain.RzGroup2Items0Click(Sender: TObject);
var
TfrmPack : TPersistentClass;
Tfrm : TForm;
begin
if hPackage = 0 then
hPackage := LoadPackage( ExtractFilePath( Paramstr(0))+'Package1.bpl' );
if hPackage = 0 then
ShowMessage('LoadPackage failed')
else begin
ShowMessage('LoadPackage OK');//这里成功了
TfrmPack := GetClass('TForm1');
if TfrmPack <> nil then
begin
ShowMessage('Getclass OK');//失败,
Tfrm := TComponentClass(TfrmPack).Create(Application) as TForm;
Tfrm.WindowState := wsMaximized;
Tfrm.Parent := rzPanel1;
Tfrm.Show;
end else
ShowMessage('Getclass failed') //此处提示'Getclass failed'
我的那个PACKAGE里边就有一个TFORM1类,而且注册过了,注册代码是这样的
initialization
RegisterClass(TForm1);
finalization
UnRegisterClass(TForm1);
hPackage : HModule = 0;
implementation
{$R *.dfm}
procedure TfrmMain.RzGroup2Items0Click(Sender: TObject);
var
TfrmPack : TPersistentClass;
Tfrm : TForm;
begin
if hPackage = 0 then
hPackage := LoadPackage( ExtractFilePath( Paramstr(0))+'Package1.bpl' );
if hPackage = 0 then
ShowMessage('LoadPackage failed')
else begin
ShowMessage('LoadPackage OK');//这里成功了
TfrmPack := GetClass('TForm1');
if TfrmPack <> nil then
begin
ShowMessage('Getclass OK');//失败,
Tfrm := TComponentClass(TfrmPack).Create(Application) as TForm;
Tfrm.WindowState := wsMaximized;
Tfrm.Parent := rzPanel1;
Tfrm.Show;
end else
ShowMessage('Getclass failed') //此处提示'Getclass failed'
我的那个PACKAGE里边就有一个TFORM1类,而且注册过了,注册代码是这样的
initialization
RegisterClass(TForm1);
finalization
UnRegisterClass(TForm1);