UpdateOverlayBits example for C++ 5.0 and later

int  nRet;
ILEADRaster *OverlayRaster = NULL;
CoCreateInstance(
CLSID_LEADRaster, 
NULL, 
CLSCTX_ALL, 
IID_ILEADRaster, 
 (void**)&OverlayRaster
);
   
m_pRasterIO->Load(OverlayRaster,"c:\\dic2.cmp",0,0,1);
m_pRasterProc->SetOverlayBitmap(m_LeadRasterView.GetRaster() , 0, OverlayRaster, OVERLAY_MOVE);
if (nRet = 0) 
{
m_pRasterProc->OverlayAttributes->Color = RGB(255, 255, 255);
m_pRasterProc->OverlayAttributes->Flags = OVERLAY_AUTOPROCESS | OVERLAY_AUTOPAINT;
m_pRasterProc->OverlayAttributes->OriginX = 0;
m_pRasterProc->OverlayAttributes->OriginY = 0;
m_pRasterProc->OverlayAttributes->BitPosition = m_LeadRasterView.GetRaster().GetBitmapBits() - 1;
m_pRasterProc->SetOverlayAttributes (m_LeadRasterView.GetRaster(), 0, OVERLAYATTRIBUTES_COLOR + OVERLAYATTRIBUTES_FLAGS + OVERLAYATTRIBUTES_ORIGIN + OVERLAYATTRIBUTES_BITINDEX);
}
m_pRasterProc-> UpdateOverlayBits( m_LeadRasterView.GetRaster(), 0, SETOVERLAYBITS_FROMOVERLAY);
m_pRasterProc-> Release();
OverlayRaster-> Release();