int EnumFontFamiliesEx(
HDC hdc, // handle to DC
LPLOGFONT lpLogfont, // font information
FONTENUMPROC lpEnumFontFamExProc, // callback function
LPARAM lParam, // additional data
DWORD dwFlags // not used; must be 0
);
Combobox m_Combo;
INT CALLBACK NEnumFontNameProc(LOGFONT *plf, TEXTMETRIC* /*ptm*/, INT /*nFontType*/, LPARAM lParam)
{
CComboBox* comboBox = (CComboBox*) lParam;
comboBox->AddString(plf->lfFaceName);
return TRUE;
}
///////////////列举本机所有字体
::EnumFontFamilies(GetDC()->m_hDC, (LPTSTR) NULL, (FONTENUMPROC)NEnumFontNameProc, (LPARAM)&(m_Combo));
int nCount = m_Combo.GetCount();
if (nCount > 0)
m_Combo.SetCurSel(nCount-5);
else
m_Combo.SetCurSel(0);
列举系统字体并显示。。。
简单几行就能实现了。。。。