AnnSaveArray 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::OnButtonAnnsavearray() 
{   
   long lSize; 
   HFILE hFile; 
   void * pData=NULL; 
   ILEADRasterVariant * pltRasVar = NULL; 

   CoCreateInstance(CLSID_LEADRasterVariant, NULL, CLSCTX_ALL, 
                                   IID_ILEADRasterVariant, (void **)&pltRasVar); 
   
   MyVar.Clear();
   m_pRasterAnn->AnnSaveArray(ANN_FMT_NATIVE, VARIANT_TRUE, pltRasVar, SAVE_OVERWRITE, 0); 
   lSize = pltRasVar->ItemCount
   _tcreat(TEXT("c:\\test.ann"), 0); 
   hFile = _tfopen(TEXT("c:\\test.ann"), OF_READWRITE); 
   pData = GlobalAlloc(GHND,lSize); 

   for(long i=0; i<lSize; i++)
      pData[i] = pltRasVar->ShortItemValue(i); 

   
   _lwrite(hFile, (LPCSTR)pData, lSize);   
   _lclose(hFile); 
   pltRasVar->Release ();
GlobalFree(pData); 
}