AnnGetSelectList 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 gets the number of selected annotation objects; then it gets an array of the selected object handles and checks to see if any of the objects in the array are polygons.

void CTutorDlg::OnButtonAnngetselectlist() 
{
   AnnObjectType nType; 
   short uCount; 
   long x; 
   int bSelected; 
   CString strMsg; 
   int hObject; 
   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
   strMsg.Format(TEXT("%d"),uCount); 
   strMsg = strMsg + TEXT(" objects were selected");
   AfxMessageBox (strMsg); 
   for (x=0; x<uCount; x++)
   {
      hObject = pltRasVarList->LongItemValue(x);      
      m_pRasterAnn->AnnGetType(hObject); 
         nType  = m_pRasterAnn->GetAnnType();
      if (nType == ANN_OBJECT_POLYGON) 
         bSelected = TRUE; 
   }
       if (bSelected != TRUE) 
          AfxMessageBox(TEXT("No Polygon Objects were selected"));   

   pltRasVarList->Release ();
}