很简单的啊。
如下:
package中
Tform1=class(TForm)
...
initialization
registerclass(TForm1);
finalization
unregisterclass(TForm1)
end.
project中
TFormClass=Class of TForm;
var
h:thandle;
forminstance:tform;
begin
try
h:=loadpackage(yourpkgname);
if h<>0 then
forminstance:=TFormClass(getClass('TForm1')).create(nil);
forminstance.showmodal;
unloadpackage(h);
except
showmessage('pkg not found');
end;
注意编译的时候,需要选择project/options/packages/build with runtime packages,不然
你什么也看不到。