Solved

components from DLL to a main Form HELP!!!

Posted on 1997-06-02
2
171 Views
Last Modified: 2010-04-06
Hello!
I have a problem that I could not resolve, grateful that will help me to solve it, Exists a form in my application that it is the main menu, and other forms of capture of datas that are in a DLL.
The problem is that the components of the form that exist them in the DLL want to put in a panel of the main menu form in order to don't have two activated forms.
There is attempt passing the main menu form or the Panel like parameter and change the parent propierity of the components, but it don't introduce me the components, although if it change of the form that meets in the DLL.

Like you could I make in order to solve the problem? and if you can sendme a examples of how to work with DLL's

thanks!

carlos@compac.com.mx
0
Comment
Question by:Charlie V
2 Comments
 
LVL 1

Accepted Solution

by:
ozzy earned 130 total points
ID: 1336759
In the dll, call a function called CreatePanel(Sender : TObject) where Sender would be Application.MainForm
Then in the procedure do something like this...

Procedure CreatePanel(Sender : TOBject);
VAR
Panel_One : TPanel;
Begin
PAnel_One := Tanel.Create(Sender);
..
....
end;

That should make the panel belong to the mainform because you are creating it dynamically and making the parent MAINFORM.  If you already have a form created, for example FORM1, in the dll, it's probably of type TFORM.  Just setup another one in that DLL of type TForm, for example Form2 and create it dynamically and assign the parent to MainForm.

This sound like something that you could do.

0
 

Author Comment

by:Charlie V
ID: 1336760
I been tyi to apply the example you but to the compile send me an error and is because TPanel accepts a parameter of TComponent type and not of TObject type.
Change the type of parameter and pass the compile process, but don't introduce the panel that believes in the DLL in the MainForm.

The one which I try to make is that a group of components that they meet in a DLL, all these assembled in a Panel are called from the MainForm (EXE) and they are viewed, I generate a class with all the components that I need in the DLL and I apply the example that you sent, apparently generate all the components but don't introduce it in the MainForm

here this the one which I made:

this in the DLL File

type
   TCalendar = class(TObject)
    Panel1 : TPanel;
    KSCalendar1: TKSCalendar;
    KSControlBar1: TKSControlBar;
    constructor Create(AOwner: TObject);
    destructor Destroy; override;
  private
  public
end;

var
  panCalendar : TCalendar;

procedure LoadCalendar(Sender: TObject); export;

implementation

procedure LoadCalendario(Sender: TObject);
var
  Panel_One : TPanel;
begin
  panCalendar := TCalendar.Create(Sender);
end;

constructor TCalendar.create(AOwner: TObject);
begin
   inherited Create;
   panel1 := TPanel(AOwner);
   KSCalendar1:= TKSCalendar.Create(Panel1);
   KSControlBar1:= TKSControlBar.Create(Panel1);
end;

destructor TCalendar.Destroy;
begin
   panel1.free;
   KSCalendar1.Free;
   KSControlBar1.Free;
   inherited Destroy;
end;


and this in de EXE File

procedure LoadCalendar(AOwner: TComponent);

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
  public
  end;

var
  Form1: TForm1;

implementation

uses uniCalendasinforma;

{$R *.DFM}

procedure LoadCalendar; external 'caldll' index 1;

procedure TForm1.FormCreate(Sender: TObject);
begin
   LoadCalendar(Application.MainForm);
end;

end.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
URL for downloading Google Chrome for Win XP 2 120
Multiple image collision 13 69
can't find the executable in Simulator 1 80
Delphi: Connect to running MS Outlook 4 48
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…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

911 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now