To hwave:
Thanks your suggestion, I knew how to use Tools API add submenu to delphi main menu, but i don't
know how to add menu to delphi main menu, here is a sample about how to add submenu
to delphi, if you know, could you tell me
unit SubhaExp;
interface
uses Windows,Menus,ExtCtrls,SysUtils,Forms,ToolsApi;
Type
TSubhaMenu = Class
Private
FMainMenu : TMainMenu;
FFileMenu : TMenuItem;
FGiriMenu : TMenuItem;
Procedure OnMenuItemClick(Sender : TObject);
Public
Procedure AddMenuItem;
Procedure RemoveMenuItem;
End;
Var FSubhaMenu : TSubhaMenu;
Procedure Register;
implementation
Procedure TSubhaMenu.AddMenuItem;
Var i : Integer;
Begin
FMainMenu := (BorlandIDEServices As INTAServices).MainMenu;
For i := 0 to FMainMenu.Items.Count - 1 Do
Begin
If AnsiSameCaption(FmainMenu.items.Caption, 'File') Then
Begin
FFileMenu := FMainMenu.items;
Break;
End;
End;
FGiriMenu := TMenuItem.Create(FFileMenu);
FGiriMenu.Caption := 'Subha IDE Services';
FGiriMenu.OnClick := OnMenuItemClick;
For i := 0 to FFileMenu.count - 1 Do
Begin
If FFileMenu.Items.isLine Then
Begin
FFileMenu.Insert(i,FGiriMenu);
Break;
End;
End;
End;
Procedure TSubhaMenu.RemoveMenuItem;
Var i : Integer;
Begin
For i := 0 to FFileMenu.Count - 1 Do
Begin
If AnsiSameCaption(FFileMenu.Items.Caption,'Subha IDE Services') Then
Begin
FFileMenu.Remove(FFileMenu.items);
Break;
End;
End;
End;
Procedure TSubhaMenu.OnMenuItemClick(Sender : TObject);
Begin
Application.MessageBox(PChar('This Is only a Simple Example' +
' to Work With Delphi IDE ' + #13#10 + ' For Further Details On This Contact' +
#13#10#13#10 + ' Subha@botree.co.in'),PChar('Message From Subha'),MB_OK);
End;
Procedure Register;
Begin
FSubhaMenu.AddMenuItem;
Application.MessageBox('Subha Narayanan Has Hacked Your ' +
' Delphi Environment !!! ' + #13#10 +
' See You Soon With Lot More Goodies !!! ' +
#13#10 + ' CopyRight (c) 2001, Subha Narayanan. ',
' Welcome To Delphi ',MB_SYSTEMMODAL);
End;
Initialization
FSubhaMenu := TSubhaMenu.Create;
Finalization
FSubhaMenu.RemoveMenuItem;
FSubhaMenu.Free;
end.