ShowUnderlayDlg Example for C++ 5.0 and later

void CDialogs::OnShowUnderlayDlg()
{
   int nRet; 
   ILEADRaster * Raster = NULL; 
   CoCreateInstance(
      CLSID_LEADRaster, 
      NULL, 
      CLSCTX_ALL, 
      IID_ILEADRaster, 
      (void**)&Raster
      ); 

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

   m_pRasterImageEfxDlg->ItemsCount= 3; 
   m_pRasterImageEfxDlg->PutItemFileName(0,"C:\\1.cmp");
   m_pRasterImageEfxDlg->PutItemFileName(1,"C:\\1.bmp");
   m_pRasterImageEfxDlg->PutItemFileName(2,"C:\\1.jpg");

   for (int i= 0; i < m_pRasterImageEfxDlg->ItemsCount; i ++ ) 
   {
      m_pRasterIO->Load (Raster,m_pRasterImageEfxDlg->GetItemFileName(i),0,0,1); 
      m_pRasterImageEfxDlg->PutItemDescription(i,m_pRasterImageEfxDlg->GetItemFileName(i)); 
      m_pRasterImageEfxDlg->PutItemBitmap(i, Raster->GetBitmap ());
   }

   m_pRasterImageEfxDlg->ImageEffectFlags = UNDERLAY_TILE; 
   m_pRasterImageEfxDlg->UIFlags = UNDERLAY_SHOW_PREVIEW |
                                UNDERLAY_SHOW_TOOL_ZOOMLEVEL; 

   m_pRasterImageEfxDlg->Bitmap = m_LeadRasterView.GetRaster ().GetBitmap ();
   nRet = m_pRasterImageEfxDlg->ShowUnderlayDlg((long)this->m_hWnd); 
   if ( nRet == 0 && m_pRasterImageEfxDlg->DialogStatus ==DLG_OK ) 
   {
      UnderlayRaster->PutBitmap (m_pRasterImageEfxDlg->SelectedBitmap); 
      m_pRasterProc->Underlay (m_LeadRasterView.GetRaster (), UnderlayRaster, 
                            (UnderlayConstants)m_pRasterImageEfxDlg->ImageEffectFlags ); 
   }

   Raster->Release();
   UnderlayRaster->Release();
}