AnnSetAutoMenuItemEnable Example for C++ 5.0 and later

Note: This topic is for Document/Medical only.

For more information on declaration and unlocking procedures used in testing this example, refer to Annotation Declaration Information.

void CTutorDlg::OnButtonAnnsetautomenuenable() 
{
   // disable the Delete menu item from all the selected objects
   CString strMsg = TEXT("");
   OLE_HANDLE hAnnContainer = NULL;
   hAnnContainer  = m_pRasterAnn->GetAnnContainer();
   m_pRasterAnn->AnnSetAutoMenuItemEnable(
      hAnnContainer, 
      ANN_OBJECT_CONTAINER, 
      ANN_AUTOTEXT_MENU_DELETE, ANN_MENU_DISABLED, ANN_FLAG_RECURSE | ANN_FLAG_SELECTED, 
      strMsg.AllocSysString()
      );

   // disable the Delete menu item from all the ellipse objects
   OLE_HANDLE hAnnAutomation = NULL;
   hAnnAutomation = m_pRasterAnn->GetAnnAutomation();
   m_pRasterAnn->AnnSetAutoMenuItemEnable(
      hAnnAutomation, 
      ANN_OBJECT_ELLIPSE, ANN_AUTOTEXT_MENU_DELETE, ANN_MENU_DISABLED, 
      0, 
      strMsg.AllocSysString()
      );
}