Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2007.01.21;
Скачать: CL | DM;

Вниз

Вопрос про плагины (компонент TJvPlugin)   Найти похожие ветки 

 
NeyroSpace ©   (2006-11-27 15:14) [0]

Имеем демо-код небольшого плагина в виде DLL.
{---SamplePluginOne.dpr---}
library SamplePluginOne;

uses
 ShareMem,
 SamplePluginOneU in "SamplePluginOneU.pas" {SampleUILPlugin: TJvPlugin};

exports
 RegisterPlugin;

begin

end.

{---SamplePluginOneU.pas---}
unit SamplePluginOneU;

interface

uses
 Windows,
 Messages,
 SysUtils,
 Classes,
 Dialogs,
 Forms,
 JvPlugin;

type
 TSampleUILPlugin = class(TJvPlugin)
   procedure uilPlugin1Commands0Execute(Sender: TObject);
   procedure uilPlugin1Commands1Execute(Sender: TObject);
   procedure uilPlugin1Commands2Execute(Sender: TObject);
   procedure uilPlugin1PluginMessage(Sender: TObject; APluginMessage: Integer; AMessageText: string);
   procedure uilPlugin1Configure(Sender: TObject);
 private
   { Private declarations }
 public
   { Public declarations }
 end;

function RegisterPlugin: TSampleUILPlugin; stdcall;

implementation

{$R *.DFM}

// IMPORTANT NOTE: If you change the name of the Plugin container,
// you must set the type below to the same type. (Delphi changes
// the declaration, but not the procedure itself. Both the return
// type and the type created must be the same as the declared type above.

function RegisterPlugin: TSampleUILPlugin;
begin
 Result := TSampleUILPlugin.Create(nil);
end;

procedure TSampleUILPlugin.uilPlugin1Commands0Execute(Sender: TObject);
begin
 ShowMessage("Command One clicked");
end;

procedure TSampleUILPlugin.uilPlugin1Commands1Execute(Sender: TObject);
begin
 ShowMessage("Command Two clicked");
end;

procedure TSampleUILPlugin.uilPlugin1Commands2Execute(Sender: TObject);
begin
 ShowMessage("Command Three clicked");
end;

procedure TSampleUILPlugin.uilPlugin1PluginMessage(Sender: TObject;
 APluginMessage: Integer; AMessageText: string);
begin
 ShowMessage(Format("Plugin Message number %d received. MessageText: %s", [APluginMessage, AMessageText]));
end;

procedure TSampleUILPlugin.uilPlugin1Configure(Sender: TObject);
begin
 ShowMessage("You could put a configuration dialog here, if your plugin requires one.");
end;

end.

//-------
Собственно говоря DLL-плагин экспортирует одну ф-цию function RegisterPlugin: TSampleUILPlugin; stdcall;
т.е. при вызове этой ф-ции главная программа получает указатель на класс плагина. Я так понимаю написать плагин с таким классом на VC++ нельзя? Ведь в VC++ классы имеют совершенно дугую внутреннюю структуру? Или я ошибаюсь?


 
Сергей М. ©   (2006-11-27 16:14) [1]


> Или я ошибаюсь?


Нет, не ошибаешься.



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

Текущий архив: 2007.01.21;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.045 c
2-1167857415
Ламер 2.Х
2007-01-03 23:50
2007.01.21
Indy


15-1167469742
Derww
2006-12-30 12:09
2007.01.21
Как определить связен ли граф?


6-1156174525
RedLineLab
2006-08-21 19:35
2007.01.21
Скорость соединения dial-up


2-1167458583
FIL-23
2006-12-30 09:03
2007.01.21
можно ли Delphi менять "стиль" кнопок


8-1144144674
Goorus
2006-04-04 13:57
2007.01.21
Vorbis/OGG