?
Solved

Calling function from Bpl

Posted on 2006-06-12
9
Medium Priority
?
601 Views
Last Modified: 2010-04-05
This is my Bpl:

unit GlobalUnit;


interface
uses ExtCtrls, Buttons;
//procedure vcPanelResize(Sender: TObject);

implementation

procedure vcPanelResize(Panel:TPanel);
var
  i,m,n:integer;
begin
  m:=1; n:=1;
  for i:=0 to Panel.ControlCount-1 do
    begin
      if Panel.Controls[i].ClassType=TBitBtn then
        begin
          with Panel.Controls[i] as TBitBtn do
            begin
              Top:=m;
              Left:=n;
              Width:=Panel.Width-2;
              m:=m+Height+1;
            end;
        end;
    end;
end;

exports
vcPanelResize name 'vcPanelResize';

end.

How can I call procedure vcPanelResize from my main program.
0
Comment
Question by:cula99
  • 5
  • 4
9 Comments
 
LVL 28

Expert Comment

by:2266180
ID: 16885339
something like this:
uses GlobalUnit;

....
vcPanelResize(apanel);
make sure that the bpl is in the path of the program (can be current dir). for compiling, make sure tha bpl is in the lib path of the project
0
 
LVL 2

Author Comment

by:cula99
ID: 16885429
I can put it in my uses cloasu, but I cant call procedure later. I supouse, I didnt declare it well in bpl.

Cula
0
 
LVL 28

Expert Comment

by:2266180
ID: 16885449
I never wrote a bpl :D (I know, some ppl might remain ... "amazed" (can't find the right word))
I'll do that in a few minutes and let you know my findings
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 2

Author Comment

by:cula99
ID: 16885463
10x:))
0
 
LVL 28

Accepted Solution

by:
2266180 earned 375 total points
ID: 16886124
I found this article: http://delphi.about.com/od/objectpascalide/l/aa010901c.htm
following it, I created a test app and run it just fine.

what I have done is:
unit Unit1;

interface

procedure test;

implementation

uses dialogs;

procedure test();
begin
  showmessage('test');
end;

exports
  test name 'test';

end.

in package1. changed in project p[roperties to output in current dir. compiled. installed. then created a test app:

unit bla;

interface

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

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses unit1;

procedure TForm1.FormCreate(Sender: TObject);
begin
  test;
end;

end.

open project settings, go to packages, check build with runtime packages and add "package1".
compile.
copied bpl file to the exe dir and run exe. message was shown.

in your case: uncomment:
interface
uses ExtCtrls, Buttons;
//procedure vcPanelResize(Sender: TObject);

and make sure you followed the aboe steps.
0
 
LVL 2

Author Comment

by:cula99
ID: 16886332
Its working perfectly. 10x one more time:)))
0
 
LVL 28

Expert Comment

by:2266180
ID: 16886373
usually, when it works perfectly, you give an A ;) just for the future :)
0
 
LVL 2

Author Comment

by:cula99
ID: 16887523
its working perfectly but not as I wont it. Now I have to ship all bpls I used in program that is why B. It works perfectly but it is not the best solution.
0
 
LVL 28

Expert Comment

by:2266180
ID: 16888674
well ... that is what build with runtime packages mean. I thought you know. the best solution is not to use runtime packages, I don't know of any way to use partly runtime packages, partly design packages. if you want to have some code "outside" and some compiled into the exe, then you will have to use dll's. there is no other way, AFAIK.
peace
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Loops Section Overview
Suggested Courses

755 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question