ShowTextDlg Example for C++ 5.0 and later

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

	ILEAD *m_pLead2 = NULL;
	CoCreateInstance(CLSID_LEAD,
		NULL,
		CLSCTX_ALL,
		DIID_ILEAD,
		(LPVOID*)&m_pLead2);

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

	ILEADRasterDlgEfx_U *m_pRasterDlgEfx = NULL;
	hr = CoCreateInstance(CLSID_LEADRasterDlgEfx_U,
		NULL,
		CLSCTX_ALL,
		IID_ILEADRasterDlgEfx_U,
		(LPVOID*)&m_pRasterDlgEfx);

	nRet = m_pRasterDlgKrn->InitDlg(INIT_WITH_COLOR);

	m_pLead2->Load("D:\\Images\\Vista\\Dock.jpg", 0, 0, 1);

	m_pRasterDlgEfx->Text->ForegroundBitmap = m_pLead1.GetBitmap();
	m_pRasterDlgEfx->Text->SampleText = "LEAD TOOLS";
	m_pRasterDlgEfx->Text->HiliteColor = RGB ( 255,255,255 );
	m_pRasterDlgEfx->Text->ShadowColor = RGB ( 128,128,128 );
	m_pRasterDlgEfx->Text->TextStyle = EFX_TEXT_NORMAL;
	m_pRasterDlgEfx->Text->Align = EFX_TEXTALIGN_LEFT_TOP;
	m_pRasterDlgEfx->Text->WordWrap = false;
	m_pRasterDlgEfx->Text->Angle = 450;
	m_pRasterDlgEfx->Text->ShadowXDepth = 10;
	m_pRasterDlgEfx->Text->ShadowYDepth = 10;
	m_pRasterDlgEfx->Text->EnableUseForegroundImage = true;
	m_pRasterDlgEfx->UIFlags = TEXT_SHOW_PREVIEW |
		TEXT_AUTOPREVIEW  |
		TEXT_SAMPLETEXT   |
		TEXT_STYLE        |
		TEXT_COLOR        |
		TEXT_BORDERCOLOR  |
		TEXT_ALIGN        |
		TEXT_ANGLE        |
		TEXT_WORDWRAP     |
		TEXT_FONT         |
		TEXT_FOREIMAGE    |
		TEXT_BROWSEIMAGE  |
		TEXT_SHADOWCOLOR  |
		TEXT_SHADOW_X_Y; 

	m_pRasterDlgEfx->Bitmap = m_pLead2->GetBitmap();
	nRet = m_pRasterDlgEfx->ShowTextDlg((long)m_hWnd);

	if (nRet == 0 && m_pRasterDlgEfx->DialogStatus == DLG_OK) 
	{
		CString csRes1; 
		CString csRes2; 
		CString csRes3; 

		csRes1.Format(TEXT("SampleText: %s\nAngle: %ld\nTextStyle: %d\nTextAlign: %d\n"),
			(LPCSTR)m_pRasterDlgEfx->Text->SampleText, 
			m_pRasterDlgEfx->Text->Angle, 
			m_pRasterDlgEfx->Text->TextStyle, 
			m_pRasterDlgEfx->Text->Align); 

		csRes2.Format(TEXT("WordWrap: %d\nUseForeImage: %d\n"),
			m_pRasterDlgEfx->Text->WordWrap, 
			m_pRasterDlgEfx->Text->EnableUseForegroundImage); 

		csRes3.Format(TEXT("ShadowX: %d\nShadowY: %d\nShadowColor: %ld\nTextColor: %ld\nHiliteColor: %ld"),
			m_pRasterDlgEfx->Text->ShadowXDepth, 
			m_pRasterDlgEfx->Text->ShadowYDepth, 
			m_pRasterDlgEfx->Text->ShadowColor, 
			m_pRasterDlgEfx->Text->Color, 
			m_pRasterDlgEfx->Text->HiliteColor); 

		AfxMessageBox(csRes1 + csRes2 + csRes3); 

		m_pLead1.SetBitmap(m_pRasterDlgEfx->Text->ForegroundBitmap);
	}
}