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

Вниз

как добавить пункт меню из DLL ?   Найти похожие ветки 

 
han-bratan   (2004-08-19 15:58) [0]

как добавить пункт меню из DLL в главное меню главого окна приложения?


 
Мастер ©   (2004-08-19 16:31) [1]

DLL:


library Menu;

uses
 SysUtils,
 Classes,
 Menus;

procedure MenuItem_Add(MainMenu1: TMainMenu;Caption: PChar);
var
 NewItem: TMenuItem;
begin
 NewItem := TMenuItem.Create(MainMenu1);
 MainMenu1.Items.Add(NewItem);
 NewItem.Caption := Caption;
end;

exports
 MenuItem_Add;

end.


Пример:

unit Unit1;

interface

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

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

procedure MenuItem_Add(MainMenu1: TMainMenu;Caption: PChar);external "Menu.dll";

var
 Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
 menuItem_Add(MainMenu1,"Ìîé ïóíêò ìåíþ1");
end;

end.


 
Гаврила ©   (2004-08-19 18:37) [2]


> Мастер ©   (19.08.04 16:31) [1]


Саш, ты забыл добавить BwRTP
иначе не выйдет


 
han-bratan   (2004-08-19 19:30) [3]

Вызов функции добавления должен происходить в исходнике DLL а не главного приложения. Как поступить в таком случае?



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

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

Наверх




Память: 0.47 MB
Время: 0.042 c
1-1092884302
FastByte
2004-08-19 06:58
2004.09.05
Картинки в Excel


14-1092807057
Мюмзик в мове
2004-08-18 09:30
2004.09.05
язык влияет на мышление


14-1092657903
WondeRu
2004-08-16 16:05
2004.09.05
E-mail клиент на мобильнике!!!!!!!!!!!!!!!!!!


6-1088602619
maxistent
2004-06-30 17:36
2004.09.05
Связь компов через INTERNET


14-1092725104
CRACKISH
2004-08-17 10:45
2004.09.05
ADO?