load package and getclass

312 views
Skip to first unread message

Daniel Magin

unread,
Mar 28, 2002, 8:38:21 AM3/28/02
to
hi all,

in a package i have a unit with a form2, loading the package in my project
work fine but getcall and findclass give me evry time nil back. i am going
crazy !''!+!'*'!

any ideas???

thanx daniel

w2000 d6sp1


application call:


------------------------------
procedure TForm1.Button1Click(Sender: TObject);
var
PackageModule: HModule;
AClass: TPersistentClass;
begin
PackageModule :=
LoadPackage('E:\Programme\Borland\Delphi6\Projects\Bpl\Package1.bpl');
if PackageModule <> 0 then //<- work OK
begin
AClass := GetClass('TForm2'); //<-- evry time NIL

if AClass <> nil then
with TComponentClass(AClass).Create(Application)
as TCustomForm do
begin
ShowModal;
Free;
end;

UnloadPackage(PackageModule);
end;
end;


------------------------------
form2 in package code:

unit Unit2;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

type
TForm2 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form2: TForm2;

implementation

{$R *.DFM}

initialization
RegisterClass(TForm2);
finalization
UnRegisterClass(TForm2);
end.

Peter Below (TeamB)

unread,
Mar 28, 2002, 1:50:38 PM3/28/02
to
In article <3ca31ae2$1_1@dnews>, Daniel Magin wrote:
> in a package i have a unit with a form2, loading the package in my project
> work fine but getcall and findclass give me evry time nil back. i am going
> crazy !''!+!'*'!

Did you build the host app with run-time packages, at minimum with VCL60.bpl?

--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be


eftekh...@gmail.com

unread,
Jun 11, 2014, 4:37:06 AM6/11/14
to
Hi
For this problem:
you must set an option in main exec project.
in delphi 7 menu bar go to:

Project--> options then select package tab.
Check the "Build with runtime packages" checkbox and Ok.
now run your application;

Reply all
Reply to author
Forward
0 new messages