AnnLock example for C++ 4.0 and later

Note: This topic is for Document/Medical only.

This example locks objects of type ANNOBJECT_ELLIPSE using the key "IkeStarnes".

   int nType;
   int uCount;
   long x;
   int bSelected;
   int hObject;
   VARIANT aObjects;

   VariantInit(&aObjects);
   uCount = m_Lead1.AnnGetSelectCount();  //get number of selected objects
   aObjects = m_Lead1.AnnGetSelectList(); //get handles of the selected objects
   for (x=0; x<uCount; x++)
   {
      SafeArrayGetElement(aObjects.parray, &x, &hObject);
      nType = m_Lead1.AnnGetType(hObject);
      if (nType == ANNOBJECT_ELLIPSE)
      {
         bSelected = TRUE;
         m_Lead1.AnnLock(hObject, "IkeStarnes", FALSE);
      }
   }
       if (bSelected != TRUE)
          AfxMessageBox("No Ellipse Objects were selected");
   VariantClear(&aObjects);