EncodeABIC example for Visual C++

void CDemo::OnEncodeABIC()
{
   int nRet;
   CString strFileName;
   int i;

   ILEADRaster  * pRaster = NULL;
   CoCreateInstance(CLSID_LEADRaster, NULL, CLSCTX_ALL, IID_ILEADRaster, (void**)&pRaster);

   ILEADRasterIO  * pRasterIO = NULL;
   CoCreateInstance(CLSID_LEADRasterIO, NULL, CLSCTX_ALL, IID_ILEADRasterIO, (void**)&pRasterIO);

   ILEADRasterVariant  * pInputData = NULL;
   CoCreateInstance(CLSID_LEADRasterVariant, NULL, CLSCTX_ALL, IID_ILEADRasterVariant, (void**)&pInputData);

   ILEADRasterVariant  * pOutputData = NULL;
   CoCreateInstance(CLSID_LEADRasterVariant, NULL, CLSCTX_ALL, IID_ILEADRasterVariant, (void**)&pOutputData);

   m_RasterView.GetRaster().UnlockSupport(L_SUPPORT_ABIC_READ, L_KEY_ABIC_READ);

   nRet = pRasterIO->Load (pRaster, "c:\\Abic.bmp", 0, 0, 1);

   pInputData = pRasterIO->SaveArray(pRaster, FILE_RAW, 0, (QFactorConstants)0);

   nRet = pRasterIO->EncodeABIC(pInputData, 4, 472, 221, &pOutputData, FALSE);

   if(nRet == 0)
   {
      CFile OutputFile(TEXT("c:\\Image2Raw.ica"), CFile::modeWrite | CFile::modeCreate);
      int ddd = pOutputData->ItemCount;
      for(i =0; i<pOutputData->ItemCount; ++i)
      {
         unsigned char Byte = (unsigned char) pOutputData->GetShortItemValue (i);
         OutputFile.Write(&Byte, 1);
      }

      OutputFile.Close();
   }

   pRasterIO->Release();
   pInputData->Release();
   pOutputData->Release();
}