AnnLoadArray 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::OnButtonAnnloadarray() 
{
   long lCount; 
   HFILE hFile; 
   HGLOBAL hData=NULL; 
   void FAR* pData=NULL; 
   ILEADRasterVariant * pltRasVar = NULL; 

   CoCreateInstance(CLSID_LEADRasterVariant, NULL, CLSCTX_ALL, 
                                   IID_ILEADRasterVariant, (void **)&pltRasVar); 

   
   hFile = _tfopen(TEXT("c:\\test.ann"), OF_READ); 
   lCount = _llseek(hFile, 0, SEEK_END); 
   _llseek(hFile, 0, SEEK_SET); 
   hData = GlobalAlloc(GMEM_MOVEABLE, lCount); 
   pData = GlobalLock(hData); 
   
   _lread(hFile, pData, lCount); 

   pltRasVar->Type = VALUE_ARRAY_BYTE; 
   pltRasVar->ItemCount = lCount; 

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

   GlobalUnlock(hData); 
   GlobalFree(hData); 
   
   m_pRasterAnn->AnnLoadArray(&pltRasVar, lCount, 1); 
   _lclose(hFile); 
}