ShowAddBitmapsDlg Example for C++ 5.0 and later

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

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

	ILEADRasterDlgImgEfx_U *m_pRasterDlgImgEfx = NULL;
	hr = CoCreateInstance(CLSID_LEADRasterDlgImgEfx_U, 
		NULL,
		CLSCTX_ALL,
		IID_ILEADRasterDlgImgEfx_U,
		(LPVOID*)&m_pRasterDlgImgEfx);

	nRet = m_pRasterDlgKrn->InitDlg(INIT_WITH_COLOR);

	m_pRasterDlgImgEfx->ItemsCount = 3; 
	m_pRasterDlgImgEfx->PutItemFileName(0, "D:\\Dock.jpg");
	m_pRasterDlgImgEfx->PutItemFileName(1, "D:\\Forest.jpg");
	m_pRasterDlgImgEfx->PutItemFileName(2, "D:\\Garden.jpg");

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

	m_pRasterDlgImgEfx->ImageEffectFlags = UNDERLAY_TILE; 
	m_pRasterDlgImgEfx->UIFlags = ADDBITMAPS_SHOW_PREVIEW |
		ADDBITMAPS_SHOW_TOOL_ZOOMLEVEL; 

	m_pRasterDlgImgEfx->Bitmap = m_pLead1.GetBitmap ();
	nRet = m_pRasterDlgImgEfx->ShowAddBitmapsDlg((long)this->m_hWnd); 


	if ( nRet == 0 && m_pRasterDlgImgEfx->DialogStatus ==DLG_OK ) 
	{
		if(m_pRasterDlgImgEfx-> SelectedBitmapsCount > 0) 
		{
			m_pLead1.SetBitmapList(m_pRasterDlgImgEfx->SelectedBitmapList); 
			m_pLead1.AddBitmaps(m_pRasterDlgImgEfx->ImageEffectFlags); 
		}
	}
}