ShowAutoTrimDlg Example for C++ 5.0 and later

void CDialogs::OnShowAutoTrimDlg()
{
	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->UIFlags = AUTOTRIM_SHOW_PREVIEW; 
	m_pRasterDlgImg->Bitmap = m_pLead1.GetBitmap();

	nRet = m_pRasterDlgImg->ShowAutoTrimDlg((long)m_hWnd); 
	if (nRet == 0 && m_pRasterDlgImg->DialogStatus == DLG_OK) 
	{
		m_pLead1.AutoTrim(m_pRasterDlgImg->Threshold); 
	}
}