ShowHalftoneDlg Example for C++ 5.0 and later

void CDialogs::OnShowHalftoneDlg()
{
	HRESULT hr;
	int nRet;

	ILEADRasterDlgKrn_U *m_pRasterDlgKrn = NULL;
	hr = CoCreateInstance(CLSID_LEADRasterDlgKrn_U,
		NULL,
		CLSCTX_ALL,
		IID_ILEADRasterDlgKrn_U,
		(LPVOID*)&m_pRasterDlgKrn);

	ILEADRasterDlgClr_U *m_pRasterDlgClr = NULL;
	hr = CoCreateInstance(CLSID_LEADRasterDlgClr_U,
		NULL,
		CLSCTX_ALL,
		IID_ILEADRasterDlgClr_U,
		(LPVOID*)&m_pRasterDlgClr);

	nRet = m_pRasterDlgKrn->InitDlg(INIT_WITH_COLOR);

	m_pRasterDlgClr->ItemsCount = 3;
	m_pRasterDlgClr->PutItemFileName(0, "D:\\Images\\Vista\\Dock.jpg");
	m_pRasterDlgClr->PutItemFileName(1, "D:\\Images\\Vista\\Creek.jpg");
	m_pRasterDlgClr->PutItemFileName(2, "D:\\Images\\Vista\\Garden.jpg");

	for (int i= 0; i < m_pRasterDlgClr->ItemsCount; i ++ ) 
	{
		m_pLead1.Load(m_pRasterDlgClr->GetItemFileName(i), 0, 0, 1); 
		m_pRasterDlgClr->PutItemDescription(i, m_pRasterDlgClr->GetItemFileName(i)); 
		m_pRasterDlgClr->PutItemBitmap(i, m_pLead1.GetBitmap());
	}

	m_pRasterDlgClr->Angle = 5; 
	m_pRasterDlgClr->Dimension= 5; 
	m_pRasterDlgClr->PutHalftoneType((HalftoneConstants)HALFTONE_RECT); 
	m_pRasterDlgClr->UIFlags = HALFTONE_SHOW_PREVIEW |
		HALFTONE_SHOW_TOOL_ZOOMLEVEL |
		HALFTONE_SHOW_TOOL_SHOWEFFECT |
		HALFTONE_SHOW_TOOL_ONSCREEN |
		HALFTONE_SHOW_TOOL_RESET; 

	m_pRasterDlgClr->Bitmap = m_pLead1.GetBitmap();
	nRet = m_pRasterDlgClr->ShowHalftoneDlg((long)m_hWnd); 
	if (nRet == 0 && m_pRasterDlgClr->DialogStatus == DLG_OK) 
	{
		CString StrMsg; 
		StrMsg.Format(TEXT("No. of Selected Items is  %d"), m_pRasterDlgClr->SelectedBitmapsCount); 
		MessageBox(StrMsg); 
		if (m_pRasterDlgClr->SelectedBitmapList != 0) 
			m_pLead1.SetBitmapList(m_pRasterDlgClr->SelectedBitmapList); 
	}
}