求助,VC++中枚举字体时回调函数类型转换报错
相关代码段如下:
BOOL CALLBACK EnumFontFamProc( LPENUMLOGFONT lpelf,
LPNEWTEXTMETRIC lpntm, DWORD nFontType, long lParam )
{
CFontsDlg* pWnd = (CFontsDlg*) lParam;
pWnd ->m_ctlFontList.AddString( lpelf -> elfLogFont.lfFaceName );
return TRUE;
}
// My code ends here
void CFontsDlg::FillFontList()
{
LOGFONT lf;
lf.lfCharSet = DEFAULT_CHARSET;
strcpy( lf.lfFaceName, " " );
m_ctlFontList.ResetContent();
CClientDC dc (this);
::EnumFontFamiliesEx( (HDC) dc, &lf, (FONTENUMPROC) ::EnumFontFamProc, (LPARAM) this, 0 );
}
Compiling...
FontsDlg.cpp
F:\VcTest\Fonts\FontsDlg.cpp(215) : error C2440: 'type cast' : cannot convert from '' to 'int (__stdcall *)(const struct tagLOGFONTA *,const struct tagTEXTMETRICA *,unsigned long,long)'
None of the functions with this name in scope match the target type
Error executing cl.exe.
Fonts.exe - 1 error(s), 0 warning(s)
在网上查了好多资料,没找到答案。各位高手拉小弟一把,谢谢!
PS:貌似不是程序问题。