RefBitmap example for C++ Builder

//This example demonstrates the RefBitmap property
   LEADRaster * pRaster= NULL;
   LEADRasterIO* pRasterIO= NULL;

   CoCreateInstance(CLSID_LEADRasterIO, NULL, CLSCTX_ALL, IID_ILEADRasterIO, (void**)&pRasterIO);
     CoCreateInstance(CLSID_LEADRaster, NULL, CLSCTX_ALL, IID_ILEADRaster, (void**)&pRaster);


   //Load an image into pRaster object
   pRasterIO->Load (pRaster, AnsiToOLESTR("v:\\images\\Test.bmp"), 0, 0, 1);
   ShowMessage ("pRaster->Bitmap should be non-zero: " + IntToStr((int)pRaster->Bitmap));

   //Have the LEADRasterView1 control "steal" the pRaster bitmap
   LEADRasterView1->Raster->RefBitmap = True;
   LEADRasterView1->Raster->Bitmap= pRaster->Bitmap;

   //The pRaster Bitmap has been invalidated
   ShowMessage ("pRaster->Bitmap should be zero: " + IntToStr((int)pRaster->Bitmap));

   pRaster-> Release( );
   pRasterIO-> Release( );