D
DerekBaker
I had this code previously:
void App::FillFontBox(HWND PrefsBox)
{
[snipped]
EnumFontFamilies(hdc,(LPCTSTR)NULL,(FONTENUMPROC)EnumFontNamesProc,(long)this);
[snipped]
sort(FontNames.begin(), FontNames.end(), CaselessCmp);
[snipped]
return;
}
int CALLBACK App::EnumFontNamesProc(ENUMLOGFONT FAR *lpelf,
NEWTEXTMETRICFAR*lpntm,intFontType, LPARAM lParam)
bool App::CaselessCmp(const string& s1, const string& s2)
It compiled fine. (Apologies for the window code, but I'm assuming this
is a C++ problem, rather than an OS specific one.)
I moved much of the code from FillFontBox, and the CALLBACK (__stdcall)
and predicate functions into an existing class:
vector<string> Class_Font::GetTypeFaces()
{
[snipped]
EnumFontFamilies(hdc,(LPCTSTR)
NULL,(FONTENUMPROC)EnumFontNamesProc, (long)NULL);
[snipped]
sort(TypefaceNames.begin(), TypefaceNames.end(), CaselessCmp);
return TypefaceNames;
}
int CALLBACK Class_Font::EnumFontNamesProc(ENUMLOGFONT FAR *lpelf,
NEWTEXTMETRIC FAR *lpntm, int FontType, LPARAM lParam)
bool Class_Font::CaselessCmp(const string& s1, const string& s2)
Now the compiler wants me to use "&Class_Font::CaselessCmp" and when
passing EnumFontNamesProc the compiler gives me "error C2440: 'type
cast' : cannot convert from 'overloaded-function' to 'FONTENUMPROC'"
There's only one EnumFontNamesProc.
Anyone know what's going on here?
Thank you
void App::FillFontBox(HWND PrefsBox)
{
[snipped]
EnumFontFamilies(hdc,(LPCTSTR)NULL,(FONTENUMPROC)EnumFontNamesProc,(long)this);
[snipped]
sort(FontNames.begin(), FontNames.end(), CaselessCmp);
[snipped]
return;
}
int CALLBACK App::EnumFontNamesProc(ENUMLOGFONT FAR *lpelf,
NEWTEXTMETRICFAR*lpntm,intFontType, LPARAM lParam)
bool App::CaselessCmp(const string& s1, const string& s2)
It compiled fine. (Apologies for the window code, but I'm assuming this
is a C++ problem, rather than an OS specific one.)
I moved much of the code from FillFontBox, and the CALLBACK (__stdcall)
and predicate functions into an existing class:
vector<string> Class_Font::GetTypeFaces()
{
[snipped]
EnumFontFamilies(hdc,(LPCTSTR)
NULL,(FONTENUMPROC)EnumFontNamesProc, (long)NULL);
[snipped]
sort(TypefaceNames.begin(), TypefaceNames.end(), CaselessCmp);
return TypefaceNames;
}
int CALLBACK Class_Font::EnumFontNamesProc(ENUMLOGFONT FAR *lpelf,
NEWTEXTMETRIC FAR *lpntm, int FontType, LPARAM lParam)
bool Class_Font::CaselessCmp(const string& s1, const string& s2)
Now the compiler wants me to use "&Class_Font::CaselessCmp" and when
passing EnumFontNamesProc the compiler gives me "error C2440: 'type
cast' : cannot convert from 'overloaded-function' to 'FONTENUMPROC'"
There's only one EnumFontNamesProc.
Anyone know what's going on here?
Thank you