ShowHolePunchRemoveDlg Example for C++ 5.0 and later

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

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

	ILEADRasterDlgImgDoc_U *m_pRasterDlgImgDoc = NULL;
	hr = CoCreateInstance(CLSID_LEADRasterDlgImgDoc_U, 
		NULL,
		CLSCTX_ALL,
		IID_ILEADRasterDlgImgDoc_U,
		(LPVOID*)&m_pRasterDlgImgDoc);

	nRet = m_pRasterDlgKrn->InitDlg(INIT_WITH_COLOR);

	m_pRasterDlgImgDoc->HolePunchRemove->MinHoleCount = 2; 
	m_pRasterDlgImgDoc->HolePunchRemove->MaxHoleCount = 4; 
	m_pRasterDlgImgDoc->HolePunchRemove->MinHoleWidth = 5; 
	m_pRasterDlgImgDoc->HolePunchRemove->MinHoleHeight = 5; 
	m_pRasterDlgImgDoc->HolePunchRemove->MaxHoleWidth = 10; 
	m_pRasterDlgImgDoc->HolePunchRemove->MaxHoleHeight = 10; 
	m_pRasterDlgImgDoc->HolePunchRemove->PutLocation((HolePunchRemoveConstants)HOLEPUNCH_LEFT);
	m_pRasterDlgImgDoc->HolePunchRemove->Flags = HOLEPUNCH_USE_DPI;

	m_pRasterDlgImgDoc->UIFlags = HOLEPUNCHREMOVE_AUTOPROCESS|
		HOLEPUNCHREMOVE_SHOW_PREVIEW |
		HOLEPUNCHREMOVE_SHOW_TOOL_ZOOMLEVEL;

	m_pRasterDlgImgDoc->WhiteAreaColor = RGB(255, 0, 0); 
	m_pRasterDlgImgDoc->BlackAreaColor = RGB(0, 0, 255); 

	m_pRasterDlgImgDoc->Bitmap = m_pLead1.GetBitmap();
	nRet = m_pRasterDlgImgDoc->ShowHolePunchRemoveDlg((long)m_hWnd);

	if (nRet == 0 && m_pRasterDlgImgDoc->DialogStatus == DLG_OK)
	{
		m_pLead1.HolePunchRemove(m_pRasterDlgImgDoc->HolePunchRemove->Flags,
			m_pRasterDlgImgDoc->HolePunchRemove->MinHoleCount,
			m_pRasterDlgImgDoc->HolePunchRemove->MaxHoleCount,
			m_pRasterDlgImgDoc->HolePunchRemove->MinHoleWidth,
			m_pRasterDlgImgDoc->HolePunchRemove->MinHoleHeight, 
			m_pRasterDlgImgDoc->HolePunchRemove->MaxHoleWidth, 
			m_pRasterDlgImgDoc->HolePunchRemove->MaxHoleHeight, 
			m_pRasterDlgImgDoc->HolePunchRemove->GetLocation());
	}
}