?
Solved

Calling function from Bpl

Posted on 2006-06-12
9
Medium Priority
?
567 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month8 days, 11 hours left to enroll

764 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