Solved

Calling function from Bpl

Posted on 2006-06-12
9
551 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 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

Technology Partners: 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!

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

691 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