ShowGammaAdjustmentDlg Example for C++ 5.0 and later

void CDialogs::OnShowGammaAdjustmentDlg()
{
	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->GammaRedValue= 50; 
	m_pRasterDlgClr->GammaGreenValue= 50; 
	m_pRasterDlgClr->GammaBlueValue= 50; 
	m_pRasterDlgClr->EnableGammaAllChannels= true; 
	m_pRasterDlgClr->UIFlags = GAMMAADJUSTMENT_SHOW_PREVIEW |
		GAMMAADJUSTMENT_SHOW_TOOL_ZOOMLEVEL |
		GAMMAADJUSTMENT_FORCELINKCHANNELS ; 

	m_pRasterDlgClr->Bitmap =  m_pLead1.GetBitmap();

	nRet = m_pRasterDlgClr->ShowGammaAdjustmentDlg((long)m_hWnd); 
	if (nRet == 0 && m_pRasterDlgClr->DialogStatus == DLG_OK) 
	{
		int nGamma = (m_pRasterDlgClr->GammaRedValue +
			m_pRasterDlgClr->GammaGreenValue +
			m_pRasterDlgClr->GammaBlueValue) / 3; 

		m_pLead1.GammaCorrect(nGamma); 
	}
}