1 Reply Latest reply on Jul 26, 2011 10:49 AM by gkaiseril

    Popup stamp menu on button click Adobe 10

    twinklekumar

      Hi

       

      I have developed a custom plugin using Acrobat 6.0 sdk and it has one button which user clicks and it shows menu for available stamps. This feature was working till Adobe 9 but it not working with Adobe 10.

       

      Here is the code I was using to popup menu when user click on button..

       

      AVMenuItem COmniLinkBehaviorPI::ShowDropDownMenu(CString iVersion)

      {

      m_oLog.Debug("ShowDropDownMenu called.");

       

       

      AVPageView avPageView = NULL;

      ASInt16 xHit = 0;

      ASInt16 yHit = 0;

       

       

      //Get the Menubar

      AVMenubar Menubar = AVAppGetMenubar();

       

      //Get the Tools Menu

      AVMenu ToolsMenu = AVMenubarAcquireMenuByName(Menubar, "Tools");

       

      //Get the Commenting Menu

      AVMenu CommentMenu = AVMenuItemAcquireSubmenu(AVMenuAcquireMenuItemByIndex(ToolsMenu,0));

       

      //Get the Stamps Menu

      AVMenu StampMenu = AVMenuItemAcquireSubmenu(AVMenuAcquireMenuItemByIndex(CommentMenu ,2));

       

       

       

      ASInt32 i;

      ASInt32 j;

       

      AVMenuItem tempItem;

      char buf[100];

      if(iVersion.Left(1) == "6")

      {

      m_oLog.Debug("Version found: 6.0 ");

      for(j=0;j< 3;j++)

      {

      for(i=0;i< AVMenuGetNumMenuItems(StampMenu);i++)

      {

      tempItem = AVMenuAcquireMenuItemByIndex(StampMenu, i);

       

      m_oLog.Debug(ASAtomGetString(AVMenuItemGetName(tempItem)));

       

      AVMenuItemGetTitle(tempItem,buf,sizeof(buf));

       

      m_oLog.Debug(buf);

       

      if((!strcmp(buf, "-")) || (!strcmp(buf, "&Create Custom Stamp...")) || (!strcmp(buf, "Add Cu&rrent Stamp To Favorites")) || (!strcmp(buf, "&Manage Stamps...")))

      {

      AVMenuItemRemove(tempItem);

       

      m_oLog.Debug("Seperator Item Remvoed");

       

      }

      AVMenuItemRelease(tempItem);

      }

      }

       

      }

      else if (iVersion.Left(1) =="7")

      {

      m_oLog.Debug("Version found: 7.0 ");

       

      for(i=0;i< AVMenuGetNumMenuItems(StampMenu);i++)

      {

      tempItem = AVMenuAcquireMenuItemByIndex(StampMenu, i);

       

      //m_oLog.Debug(ASAtomGetString(AVMenuItemGetName(tempItem)));

       

      AVMenuItemGetTitle(tempItem,buf,sizeof(buf));

       

      m_oLog.Debug(buf);

       

       

      if(!strcmp(buf, "&Manage Stamps..."))

      {

      AVMenuItemRemove(tempItem);

      //break;

      m_oLog.Debug("Manage Item Remvoed");

       

      }

       

      AVMenuItemRelease(tempItem);

      }

      }

       

       

      //Get the Page View object

      avPageView = AVDocGetPageView(m_oAVDoc);

       

      //Get the Mouse Position

      AVPageViewGetMousePosition(avPageView,&xHit,&yHit);

       

      //Popup the Stamps menu

      AVMenuItem  MenuItem = AVPageViewDoPopupMenu(avPageView, StampMenu   ,xHit,yHit,false,0);

       

      if (MenuItem == NULL)

      {

        m_oLog.Debug("Menu Item was not selected from dropdown stamp menu.");

      }

       

       

       

      //Release the Stamps Menu

      AVMenuRelease(StampMenu);

       

      return MenuItem;

      }

      My question is what I can do so that it will still work with Adobe 10 using same Adobe 6.0 SDK. 
      Thanks