SaveArray example for C++ Builder
long lSize;
HFILE hFile;
void HUGEP* pData=NULL;
ILEADRasterIO *pRasterIO=NULL;
ILEADRasterVariant* pRasterVar= NULL;
AnsiString cs;
CoCreateInstance(CLSID_LEADRasterIO, NULL, CLSCTX_ALL,
IID_ILEADRasterIO, (void**)&pRasterIO);
CoCreateInstance( CLSID_LEADRasterVariant,
NULL,
CLSCTX_ALL,
IID_ILEADRasterVariant,
(void**)&pRasterVar);
pRasterIO->Load(LEADRasterView1->Raster,
AnsiToOLESTR("c:\\chess.bmp"), 0, 1, 1);
pRasterVar= pRasterIO->SaveArray(LEADRasterView1->Raster,
FILE_BMP, 0, (QFactorConstants)0);
_lcreat("c:\\test.bmp", 0);
hFile = _lopen("c:\\temp\\test.bmp", OF_READWRITE);
lSize = pRasterVar->ItemCount;
pData= (char*)GlobalAlloc(GHND, lSize);
_lwrite(hFile, (LPCSTR)pData, lSize);
_lclose(hFile);
//get some info on the memory array
pRasterIO->GetArrayInfo(LEADRasterView1->Raster, pRasterVar, 1, lSize);
cs = "Format =" + IntToStr(pRasterIO->InfoFormat);
ShowMessage(cs);
if ( pRasterIO )
pRasterIO->Release();
if ( pRasterVar )
pRasterVar->Release();
if ( pData )
GlobalFree(pData);