ShowHalftoneDlg Example for C++ 5.0 and later

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

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

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

   m_pRasterColorDlg->Angle = 5; 
   m_pRasterColorDlg->Dimension= 5; 
   m_pRasterColorDlg->HalftoneType= HT_RECT; 
   m_pRasterColorDlg->UIFlags = HALFTONE_SHOW_PREVIEW |
                            HALFTONE_SHOW_TOOL_ZOOMLEVEL |
                            HALFTONE_SHOW_TOOL_SHOWEFFECT |
                            HALFTONE_SHOW_TOOL_ONSCREEN |
                            HALFTONE_SHOW_TOOL_RESET; 

   m_pRasterColorDlg->Bitmap = m_LeadRasterView.GetRaster().GetBitmap ();
   nRet = m_pRasterColorDlg->ShowHalftoneDlg((long)this->m_hWnd); 
   if ( nRet == 0 && m_pRasterColorDlg->DialogStatus ==DLG_OK ) 
   {
      CString StrMsg; 
      StrMsg.Format(TEXT("No of Selected Items are  %d"),m_pRasterColorDlg->SelectedBitmapsCount); 
      MessageBox(StrMsg); 
      if ( m_pRasterColorDlg->SelectedBitmapList != 0 ) 
         m_LeadRasterView.GetRaster ().SetBitmapList(m_pRasterColorDlg->SelectedBitmapList); 
   }
   Raster->Release();