查看所有已安装的字体
发表于:2007-07-01来源:作者:点击数:
标签:
int index; BOOL CALLBACK EnumFonts(CONST LOGFONT* lplf, CONST TEXTMETRIC *lptm,DWORD dwType,LPARAM aFontName) { CString far *aiFontName=(CString far*)aFontName; index++; aiFontName[index]=lplf->lfFaceName; return true; } void CFGDlg::OnOK(
int index; BOOL CALLBACK EnumFonts(CONST LOGFONT* lplf, CONST TEXTMETRIC *lptm,DWORD dwType,LPARAM aFontName) { CString far *aiFontName=(CString far*)aFontName; index++; aiFontName[index]=lplf->lfFaceName; return true; }
void CFGDlg::OnOK() { m_list.ResetContent();
index=-1; CString aFontName[MAX_PATH]; CPaintDC dc(this); ::EnumFonts(dc.m_hDC,NULL,(FONTENUMPROC)EnumFonts,(LPARAM)aFontName); for(int i=0; i m_list.AddString(aFontName[i]); } |
函数说明:
int EnumFonts(
HDC hdc, // handle to device context LPCTSTR lpFaceName, // pointer to font typeface name string FONTENUMPROC lpFontFunc, // pointer to callback function LPARAM lParam // address of application-supplied data ); |
原文转自:http://www.ltesting.net