How to access & modify variable values in other runtime package (BPL)?

Hi..

I'm using my own-design runtime packages (BPL) in my project. Well, I don't find any problems calling/activating those packages from my main EXE. Here's how I code it:

[code]
//the main EXE..
procedure TForm1.Button1Click(Sender:TObject);
var
AClass: TClass;
AForm: TForm;
begin
try
if FPackageHandle = 0 then
if OpenDialog1.Execute then
FPackageHandle := LoadPackage(OpenDialog1.FileName);
finally
AClass := GetClass('TForm2');
if AClass <> nil then
begin
Application.CreateForm(TComponentClass(AClass), AForm);
AForm.Show;
end;
end;
end;

//the BPL... don't know what to do....
//I have a textedit in Main .exe
//and a button in the BPL form, which I want it to send a text to the
//main form's textedit
//how can I done it... ????
[/code]

But I still found difficulties when trying to access/modify values between packages. For example, I want to fill var a:integer with '25' in main EXE from package b1.bpl... I don't have any idea on how to do it...

Could anybody help me, please..???

Thank you in advance.. ;-)
[blue]I'm Dandi Giovani - the upcoming Delphi MASTER... hwahahaaa (I'm laughing...)[/blue] :-D :-D

Comments

  • : Hi..
    :
    : I'm using my own-design runtime packages (BPL) in my project. Well, I don't find any problems calling/activating those packages from my main EXE. Here's how I code it:
    :
    : [code]
    : //the main EXE..
    : procedure TForm1.Button1Click(Sender:TObject);
    : var
    : AClass: TClass;
    : AForm: TForm;
    : begin
    : try
    : if FPackageHandle = 0 then
    : if OpenDialog1.Execute then
    : FPackageHandle := LoadPackage(OpenDialog1.FileName);
    : finally
    : AClass := GetClass('TForm2');
    : if AClass <> nil then
    : begin
    : Application.CreateForm(TComponentClass(AClass), AForm);
    : AForm.Show;
    : end;
    : end;
    : end;
    :
    : //the BPL... don't know what to do....
    : //I have a textedit in Main .exe
    : //and a button in the BPL form, which I want it to send a text to the
    : //main form's textedit
    : //how can I done it... ????
    : [/code]
    :
    : But I still found difficulties when trying to access/modify values between packages. For example, I want to fill var a:integer with '25' in main EXE from package b1.bpl... I don't have any idea on how to do it...
    :
    : Could anybody help me, please..???
    :
    : Thank you in advance.. ;-)
    : [blue]I'm Dandi Giovani - the upcoming Delphi MASTER... hwahahaaa (I'm laughing...)[/blue] :-D :-D
    :
    The package should export a function/procedure to set any variable. The exe needs to call this function with the variable to set. This is similar to a callback function. As far as I know this is the only way to do this.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion