VC枚举系统所有字体
LOGFONT lf;lf.lfCharSet = DEFAULT_CHARSET; // Initialize the LOGFONT structurestrcpy(lf.lfFaceName,"");CClientDC dc (this);//Enumerate the font families::EnumFontFamiliesEx((HDC) dc,&lf,(FONTENUMPROC) EnumFontFamProc,(LPARAM) this,0);//枚举函数int CALLBACK EnumFontFamProc(LPENUMLOGFONT lpelf,LPNEWTEXTMETRIC lpntm,DWORD nFontType,long lparam){ // Create a pointer to the dialog window CDay7Dlg* pWnd = (CDay7Dlg*) lparam; // add the font name to the list box pWnd ->m_ctlFontList.AddString(lpelf ->elfLogFont.lfFaceName); // Return 1 to continue font enumeration return 1;}其中m_ctlFontList是一个列表控件变量
|