ShowHistogramDlg Example for C++ 5.0 and later

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

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

	ILEADRasterDlgImg_U *m_pRasterDlgImg = NULL;
	hr = CoCreateInstance(CLSID_LEADRasterDlgImg_U,
		NULL,
		CLSCTX_ALL,
		IID_ILEADRasterDlgImg_U,
		(LPVOID*)&m_pRasterDlgImg);

	nRet = m_pRasterDlgKrn->InitDlg(INIT_WITH_COLOR);

	m_pRasterDlgImg->Bitmap = m_pLead1.GetBitmap();
	m_pRasterDlgImg->BlueChannelPenColor = RGB(0, 0, 255); 
	m_pRasterDlgImg->GreenChannelPenColor = RGB(0, 255, 0); 
	m_pRasterDlgImg->RedChannelPenColor = RGB(255, 0, 0); 
	m_pRasterDlgImg->MasterChannelPenColor = RGB(0, 0, 0); 
	m_pRasterDlgImg->UIFlags = HISTOGRAM_SHOW_VIEWSTYLE |
		HISTOGRAM_USERPENCOLORS; 

	nRet = m_pRasterDlgImg->ShowHistogramDlg((long)m_hWnd); 
}