Главная страница
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.065 c
3-1092295856
сергей1
2004-08-12 11:30
2004.09.05
insert into


14-1092549805
vidiv
2004-08-15 10:03
2004.09.05
Геометрическая задача


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


4-1090315529
maguk
2004-07-20 13:25
2004.09.05
Вопрос по RichEdit 2.0


6-1088757109
LEONardo
2004-07-02 12:31
2004.09.05
TclientSocket