AnnGetAutoMenuItemEnable example for C++ Builder

//This example disables the "delete" menu item from the annotation hGlobalAnn.
//Global declarations
LEADRasterAnnotation * pRasterAnn= NULL;
LEADRasterAnnToolBar* pRasterAnnToolbar= NULL;
long hGlobalAnn; 

//Note that hGlobalAnn should be a valid value before clicking Button2.

void __fastcall TForm1::Button1Click(TObject *Sender)
{
   CoCreateInstance(CLSID_LEADRasterAnnotation, NULL, CLSCTX_ALL, IID_ILEADRasterAnnotation, (void**)&pRasterAnn);
   CoCreateInstance(CLSID_LEADRasterAnnToolBar, NULL, CLSCTX_ALL, IID_ILEADRasterAnnToolBar, (void**)&pRasterAnnToolbar);
   pRasterAnn->AnnParentRasterView = LEADRasterView1->Raster;
   LEADEventSink1->Connect (pRasterAnn, DIID__LEADRasterAnnotationEvents);
   pRasterAnn->AnnUserMode = ANN_USERMODE_DESIGN ;
}
void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
   if (pRasterAnn)
      pRasterAnn->Release ();
   if (pRasterAnnToolbar)
      pRasterAnnToolbar-> Release();
}
void __fastcall TForm1::Button2Click(TObject *Sender)
{
   AnnMenuConstants iEnable;
   //This example disables the "delete" menu item from the annotation hGlobalAnn.
   pRasterAnn->AnnSetAutoMenuItemEnable (hGlobalAnn, ANN_OBJECT_CONTAINER, ANN_AUTOTEXT_MENU_DELETE, ANN_MENU_DISABLED, ANN_FLAG_RECURSE + ANN_FLAG_SELECTED, AnsiToOLESTR(""));
   pRasterAnn->AnnGetAutoMenuItemEnable (hGlobalAnn, ANN_OBJECT_CONTAINER, ANN_AUTOTEXT_MENU_DELETE);
   iEnable= pRasterAnn->AnnAutoMenuItemEnable;
   switch (iEnable)
   {
      case ANN_MENU_ENABLED:
         ShowMessage ("ANN_MENU_ENABLED");
         break;
      case ANN_MENU_DISABLED:
         ShowMessage ("ANN_MENU_DISABLED");
         break;

      case ANN_MENU_DEFAULT:
         ShowMessage ("ANN_MENU_DEFAULT");
         break;
   }
}