procedure TfrmMain.Button3Click(Sender: TObject);
var
phm: HMODULE;
LoadSheet: function: Boolean;
begin
phm := LoadPackage('G:\Delphi Rep\Packages\Curriculum Maintenance\' +
'CurriculumMaintenance.bpl');
if phm <> 0 then begin
try
@LoadSheet := GetProcAddress(phm, 'Execute');
if Assigned(LoadSheet) then LoadSheet
else ShowMessage('Function not found.');
finally
UnloadPackage(phm);
end;
end
else ShowMessage('Package not found!');
end;
======================================================
Here's the code of the package's main form filename: urfmReg004S.
function Execute(): Boolean;
begin
frmReg004S := TfrmReg004S.Create(Nil);
try
frmReg004S.ShowModal;
finally
frmReg004S.Release;
end;
end;
.
.
.
exports
Execute;
=======================================================
I have also placed a code in the OnCreate event of ufrmReg004S. The code
contains the creation of the package's data module. How come an error is
raised? it says "Application is not licensed to use this feature?" The line
where the error is raised contains: frmDataModule :=
TfrmDataModule.Create(Nil);
"yc" <y...@yc.yc> wrote in message news:3f93a4cb$1...@newsgroups.borland.com...
Free terminates the Object from memory;
Release calls an interface routine -> depending how the routine is done
if freed or not or whatever.
If you use "normal" Objects, use Create & Free (or Create and Close on
forms);
If you use interfaces you'd use the Release routine (Details see Delphi
Help).
Marc
You're thinking about _Release. The Release method (no underscore) posts a
message to the message queue telling a form to free itself. This is
typically used in code inside an event of the form.
Cheers,
Ignacio
--
No, don't send me e-mail directly. No, just don't.
I answered this a few messages back. If you feel like you are not getting
an answer you will have to post more details or better yet a complete
example to the attachments group.
Marc