ShowInvertTextDlg Example for C++ 5.0 and later

void CDialogs::OnShowInvertTextDlg()
{
	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->InvertedText->MinInvertWidth = 900; 
	m_pRasterDlgImgDoc->InvertedText->MinInvertHeight = 56; 
	m_pRasterDlgImgDoc->InvertedText->MinBlackPercent = 75; 
	m_pRasterDlgImgDoc->InvertedText->MaxBlackPercent = 95; 
	m_pRasterDlgImgDoc->InvertedText->Flags = INVERTEDTEXT_USE_DIAGONALS |INVERTEDTEXT_USE_DPI; 
	m_pRasterDlgImgDoc->WhiteAreaColor = RGB(255, 0, 0); 
	m_pRasterDlgImgDoc->BlackAreaColor = RGB(0, 0, 255); 

	m_pRasterDlgImgDoc->UIFlags = INVERTEDTEXT_AUTOPROCESS |
		INVERTEDTEXT_SHOW_PREVIEW |
		INVERTEDTEXT_SHOW_TOOL_ZOOMLEVEL; 

	m_pRasterDlgImgDoc->Bitmap = m_pLead1.GetBitmap();

	nRet = m_pRasterDlgImgDoc->ShowInvertTextDlg((long)m_hWnd);

	if (nRet == 0 && m_pRasterDlgImgDoc->DialogStatus == DLG_OK)
	{
		m_pLead1.InvertedText(m_pRasterDlgImgDoc->InvertedText->Flags,
			m_pRasterDlgImgDoc->InvertedText->MinInvertWidth,
			m_pRasterDlgImgDoc->InvertedText->MinInvertHeight,
			m_pRasterDlgImgDoc->InvertedText->MinBlackPercent, 
			m_pRasterDlgImgDoc->InvertedText->MaxBlackPercent);
	}
}