AnnLock 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.

//This example locks objects of type ANNOBJECT_ELLIPSE using the key "IkeStarnes".
void CTutorDlg::OnButtonAnnlock() 
{
   AnnObjectType nType; 
   short uCount; 
   long x; 
   int bSelected; 
   int hObject;   
   CString str = TEXT("Ike Starnes");
   ILEADRasterVariant * pltRasVarList = NULL; 

   CoCreateInstance(CLSID_LEADRasterVariant, NULL, CLSCTX_ALL, 
                                   IID_ILEADRasterVariant, (void **)&pltRasVarList); 
   
   m_pRasterAnn->AnnGetSelectCount();  //get number of selected objects
   uCount  = m_pRasterAnn->GetAnnSelectCount();
   m_pRasterAnn->AnnGetSelectList(pltRasVarList); //get handles of the selected objects
   for (x=0; x<uCount; x++)
   {
      hObject = pltRasVarList->LongItemValue(x);      
      m_pRasterAnn->AnnGetType(hObject); 
      nType = m_pRasterAnn->GetAnnType();
      if (nType == ANN_OBJECT_ELLIPSE) 
      {
         bSelected = TRUE; 
         m_pRasterAnn->AnnLock(hObject, str. AllocSysString(), VARIANT_FALSE); 
      }
   }
   if (bSelected != TRUE) 
      AfxMessageBox(TEXT("No Ellipse Objects were selected"));   

   pltRasVarList->Release ();
}