Link to home
Start Free TrialLog in
Avatar of Charlie V
Charlie V

asked on

components from DLL to a main Form HELP!!!

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
ASKER CERTIFIED SOLUTION
Avatar of ozzy
ozzy

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Charlie V
Charlie V

ASKER

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.