🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.opentoolsapi
Article #124

Create Main Menu item..

#124
From: Linces
Date: Fri, 22 Feb 2008 12:43
92 lines
2772 bytes
Hi..

How i create a Main Menu item in the Delphi IDE "Like GExperts do", i do 
like code below, but dont work, plz look:

---------------------------------
unit ENDSISWizard;

interface

uses
   ToolsAPI, Windows, SysUtils, Classes, Forms, Messages, Menus;

type
   TADPCHStickerWizard = class(TNotifierObject, IOTAWizard, IOTAMenuWizard)
   public
     { IOTAWizard }
     function GetIDString: string;
     function GetName: string;
     function GetState: TWizardState;
     procedure Execute;
     { IOTAMenuWizard }
     function GetMenuText: string;
   end;

procedure Register;

implementation

procedure Register;
begin
   RegisterPackageWizard(TADPCHStickerWizard.Create);
end;

procedure TADPCHStickerWizard.Execute;
var
   i : integer;
   MainMenu: TMainMenu;
   MenuPrincipal: TMenuItem;
begin
   inherited Create;
   MainMenu := (BorlandIDEServices as INTAServices).MainMenu;
   MenuPrincipal := TMenuItem.Create(nil);
   MenuPrincipal.Caption := 'E&ndsis Wizard';
   MenuPrincipal.Name := 'EndsisWizard';
   // Insert menu in the IDE.
   MainMenu.Items.Insert(9, MenuPrincipal);
end;

function TADPCHStickerWizard.GetIDString: string;
begin
  Result := 'EndSis.EndsisWizard';
  Execute;
end;

function TADPCHStickerWizard.GetMenuText: string;
begin
   Result := 'E&ndsis Wizard';
end;

function TADPCHStickerWizard.GetName: string;
begin
   Result := 'EndSis.EndsisWizard';
end;

function TADPCHStickerWizard.GetState: TWizardState;
begin
   Result := [wsEnabled];
end;

procedure InitWizard;
begin
   // nothing needed
end;

procedure DoneWizard;
begin
   // Remove
end;

initialization
   InitWizard;

finalization
   DoneWizard;


end.

--------------------

Thanks
Technical Details
Message-ID: <47bec376@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!out04b.usenetserver.com!news.usenetserver.com!in04.usenetserver.com!news.usenetserver.com!in03.usenetserver.com!news.usenetserver.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10c3df,f02deeab2ac06d1b,start
X-Google-Attributes: gid10c3df,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Fri, 22 Feb 2008 09:43:32 -0300
From: Linces <contato@delphifontes.com.br>
User-Agent: Thunderbird 2.0.0.9 (Windows/20071031)
MIME-Version: 1.0
Newsgroups: borland.public.delphi.opentoolsapi
Subject: Create Main Menu item..
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Antivirus: avast! (VPS 080221-0, 21/02/2008), Outbound message
X-Antivirus-Status: Clean
NNTP-Posting-Host: 189.15.70.71
Message-ID: <47bec376@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1203684214 189.15.70.71 (22 Feb 2008 04:43:34 -0700)
Lines: 92
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!out04b.usenetserver.com!news.usenetserver.com!in04.usenetserver.com!news.usenetserver.com!in03.usenetserver.com!news.usenetserver.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail