Вниз
Скачать: CL | DM;

Создание плагинов   Найти похожие ветки 

← →
Medved ©   (2005-08-30 14:47) [0]

Суть проблемы: есть программа с формами. Нужно, чтобы была возможность загружать некоторые формы из DLL. Код, приведенный ниже, работает неправильно (выход из программы - после двух нажатий на кнопку закрытия одного окна или одного нажатия на каждом из окон по очереди). Может, у мастеров есть какие-то идеи?

LoadPlugin.dpr


program LoadPlugin;

uses
 Forms,
 Unit1 in "Unit1.pas" {Form1};

{$R *.res}

begin
 Application.Initialize;
 Application.CreateForm(TForm1, Form1);
 Application.Run;
end.


Plugin.dpr


library plugin;

 uses
   ShareMem,
   SysUtils,
   Classes,
   Forms,
   Unit2 in "Unit2.pas" {Form2};

{$R *.res}

 procedure Init;
 begin
   Application.Initialize;
   Application.CreateForm(TForm2, Form2);
   Application.Run;
 end;

 exports
   Init name "Init";

begin
end.


Unit1.pas


unit Unit1;

interface

uses
 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
 Dialogs, StdCtrls;

type
 TForm1 = class(TForm)
   Button1: TButton;
   procedure Button1Click(Sender: TObject);
 private
   { Private declarations }
 public
   { Public declarations }
 end;

var
 Form1: TForm1;

implementation

{$R *.dfm}

procedure Init; external "plugin.dll" name "Init";

procedure TForm1.Button1Click(Sender: TObject);
begin
 // load form form DLL
 Init;
end;

end.


Unit2.pas


unit Unit2;

interface

uses
 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
 Dialogs, StdCtrls;

type
 TForm2 = class(TForm)
   Memo1: TMemo;
 private
   { Private declarations }
 public
   { Public declarations }
 end;

var
 Form2: TForm2;

implementation

{$R *.dfm}

end.


← →
xShadow ©   (2005-08-30 15:15) [1]

http://narod.yandex.ru/cgi-bin/yandsearch?user=delphiworld&text=%F4%EE%F0%EC%E0+%E2+dll&where=2

Почитай для начала.


← →
Digitman ©   (2005-08-30 15:25) [2]

program LoadPlugin;

uses
ShareMem,
Forms,
Unit1 in "Unit1.pas" {Form1};


← →
Medved ©   (2005-08-30 15:39) [3]

Спасибо! Попробую разобраться.


← →
Суслик ©   (2005-08-30 15:55) [4]

Копай лучше в сторону runtime пакетов.
С ними куда меньше проблем, чем с dll.

Почитай об этом материалы на сайте www.delphikingdom.ru



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.46 MB
Время: 0.026 c
2-1124097041
root187
2005-08-15 13:10
2005.09.25
ustanovka BDE


1-1125335901
тыдынь
2005-08-29 21:18
2005.09.25
Как выровнять текст по правому краю в TEdit?


5-1100515449
Lisii
2004-11-15 13:44
2005.09.25
Компонент наследник TGraphicsControl - вращение объёмной фигуры


3-1123674956
Xmen
2005-08-10 15:55
2005.09.25
MSSQL 2000 (sp2) c Full - Text Search


5-1100761074
Stanislav
2004-11-18 09:57
2005.09.25
Не создаеься потомок Tcollectionitem




   Наверх