Hello,
I have created some menuitems under File->Shapes-> in microsoft visio. Now i
want to handle a click event for the menuitem that i created. But i am not
clear how to achieve this. Should i use markerevent? It would be great if
anybody could help me..
Visio.UIObject UI;
//vsoMenuSets:The collection of menu sets
Visio.MenuSets visMenuSets;
//vsoMenuSet:The drawing window menu set
Visio.MenuSet visMenuSet;
//vsoMenu:The menu used for demonstration
Visio.Menu visMenu;
// vsoMenus:The menu collection for the drawing window menu
set
Visio.Menus visMenus;
//vsoMenuItems:The collection of items in the menu
Visio.MenuItems visMenuItems;
//vsoMenuItem:The new menu item added to the collection
Visio.MenuItem visMenuItem;
Visio.MenuItem visMenuItem1;
Visio.MenuItem visMenuItem2;
Visio.MenuItem visMenuItem3;
Visio.MenuItem visMenuItem4;
Visio.MenuItem visMenuItem5;
//Get a UIObject object that represents Microsoft Visio
//built-in menus
UI = applicationObj.BuiltInMenus;
//Get the MenuSets collection
visMenuSets = UI.MenuSets;
//Get the drawing window menu set.
visMenuSet =
visMenuSets.get_ItemAtID((int)Visio.VisUIObjSets.visUIObjSetDrawing);
//Get the Menus collection.
visMenus = visMenuSet.Menus;
//Point to the "File" menu
visMenu = visMenus[0];
//Get the MenuItems collection
visMenuItems = visMenu.MenuItems;
//Add a Performance Engineering menu before the Window
menu
visMenuItem = visMenuItems[9].MenuItems.AddAt(0);
visMenuItem.Caption = "Performance Engg";
// visMenuItem.BeginGroup = true;
//Add a menu item to the new Performance Engineering menu
visMenuItem1 =
visMenuItems[9].MenuItems[0].MenuItems.AddAt(0);
visMenuItem1.Caption = "Application Servers";
visMenuItem2 =
visMenuItems[9].MenuItems[0].MenuItems.AddAt(1);
visMenuItem2.Caption = "ESBs";
visMenuItem3 =
visMenuItems[9].MenuItems[0].MenuItems.AddAt(2);
visMenuItem3.Caption = "Database Servers";
visMenuItem4 =
visMenuItems[9].MenuItems[0].MenuItems[0].MenuItems.AddAt(0);
visMenuItem4.Caption = "IBM WebSphere";
visMenuItem5 =
visMenuItems[9].MenuItems[0].MenuItems[0].MenuItems.AddAt(1);
visMenuItem5.Caption = "BEA Weblogic";
applicationObj.SetCustomMenus(UI);
Now i don know how to proceed from here. I used marker Events but it
doesnt seem to work.