Delphi BPL FMX XE3 Form Resource TForm1 not found

1.1k Views Asked by At

I have made a Form which I want to distribute in a BPL.
So I created a new Package and a new Form, added registerClass to the initialization section of my form's unit and tried to manually load the BPL file with roughly the following code:

var
  frmHost
  : THandle;

  frmClass
  : TPersistentClass;

begin
  frmHost := LoadPackage(PChar(ExtractFilePath(ParamStr(0)) + 'frm.170.bpl'));
  if frmHost = 0 then //...

  frmClass := GetClass('TForm1');
  if frmClass = nil then // ...

  with TComponentClass(frmClass).Create(nil) as TCustomForm do
  begin
    ShowModal;
    Free;
  end;
end.

When I run the application, it stops on line with TComponentClass(... and tells me

Exception-Class EResNotFound with Message 'Resource TForm1 not found'

What am I missing (except for unloading and cleanup)?

0

There are 0 best solutions below