DlgFont Example for C++ 5.0 and later

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

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

	ILEADRasterDlgImgEfx_U *m_pRasterDlgImgEfx = NULL;
	hr = CoCreateInstance(CLSID_LEADRasterDlgImgEfx_U, 
		NULL,
		CLSCTX_ALL,
		IID_ILEADRasterDlgImgEfx_U,
		(LPVOID*)&m_pRasterDlgImgEfx);

	nRet = m_pRasterDlgKrn->InitDlg(INIT_WITH_COLOR);

	CString strDlg; 
	m_pRasterDlgImgEfx->Bitmap = m_pLead1.GetBitmap();
	m_pRasterDlgImgEfx->EnableZoomToFit= true; 

	m_pRasterDlgImgEfx->UIFlags = MOTIONBLUR_SHOW_PREVIEW |
		MOTIONBLUR_SHOW_TOOL_ZOOMLEVEL; 

	m_pRasterDlgKrn->SetDlgString(MOTIONBLUR_IDSTR_CAPTION, "My Custom Caption");

	IFont * pFont = NULL; 
	CY size; 
	CString csFontName; 

	csFontName = _T("Bones");
	BSTR bstrFontName = csFontName.AllocSysString();

	IFontDisp * pFontDisp = m_pRasterDlgKrn->GetDlgFont();
	pFontDisp->QueryInterface(IID_IFont, (void **)&pFont); 
	pFont->put_Name(bstrFontName); 

	size.Hi = 0; 
	size.Lo = 9*10000L; // 9 point

	pFont->put_Size(size); 

	IFontDisp * pMyFontDisp = NULL; 

	pFont->QueryInterface(IID_IFont, (void **)&pMyFontDisp);
	m_pRasterDlgKrn->PutDlgFont(pMyFontDisp);

	SysFreeString(bstrFontName);
	pMyFontDisp->Release();
	pFont->Release();
	pFontDisp->Release();

	nRet = m_pRasterDlgImgEfx->ShowMotionBlurDlg ((long)this->m_hWnd);

	if (nRet == 0 && m_pRasterDlgImgEfx->DialogStatus == DLG_OK)
	{
		m_pLead1.MotionBlur(m_pRasterDlgImgEfx->Dimension,
			m_pRasterDlgImgEfx->Angle,
			m_pRasterDlgImgEfx->EnableUniDirectional);
	}
}