首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

MFC,EnumFontFamiliesEx回调函数,该怎么解决

2013-06-25 
MFC,EnumFontFamiliesEx回调函数在程序中用该Ex函数,会出现很多重复的项,不知道为什么,但是用EnumFontFami

MFC,EnumFontFamiliesEx回调函数
在程序中用该Ex函数,会出现很多重复的项,不知道为什么,但是用EnumFontFamilies就不会。。。

void CMainWnd::FillListBox()
{
m_wndListBox.ResetContent();

CClientDC dc(this);
::EnumFontFamiliesEx((HDC)dc
,NULL
,(FONTENUMPROC)EnumFontFamProc
,(LPARAM)this,NULL);
}
int CALLBACK CMainWnd::EnumFontFamProc(ENUMLOGFONT* lpelf
   ,NEWTEXTMETRIC* lpntm
   ,int nFontType
   ,LPARAM lParam)
{
CMainWnd* pWnd = (CMainWnd*)lParam;
pWnd->m_wndListBox.SetRedraw(FALSE);
if((pWnd->m_wndCheckBox.GetCheck() == BST_UNCHECKED)
||(nFontType & TRUETYPE_FONTTYPE))
pWnd->m_wndListBox.AddString(lpelf->elfLogFont.lfFaceName);
pWnd->m_wndListBox.SetRedraw(TRUE);
return 1;
}
callback MFC C
[解决办法]
lfCharSetIf set to DEFAULT_CHARSET, the function enumerates all uniquely-named fonts in all character sets. (If there are two fonts with the same name, only one is enumerated.) If set to a valid character set value, the function enumerates only fonts in the specified character set.

热点排行