Solved

Calling function from Bpl

Posted on 2006-06-12
9
519 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 2

Author Comment

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

Accepted Solution

by:
2266180 earned 125 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

860 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