|
-
Jan 15th, 2003, 09:20 AM
#1
Thread Starter
Member
EnumFontFamiliesEx: ???FONTENUMPROC????
Hey,
Has anyone ever used this function? What it the documentation is saying and what is in the header files seem to be completely different. FONTENUMPROC, according to the documentation should be defined as...
Code:
typedef int CALLBACK (* FONTENUMPROCA)(ENUMLOGFONTEX *, NEWTEXTMETRICEX *, int, LPARAM);
typedef FONTENUMPROCA FONTENUMPROC;
But its not.
This is a section of WinGDI.h, from the May 2002 SDK. This function is suppose to be available since WinNT 4.0, so should these headers have it? The definition I am finding is used with EnumFonts(), but... ehh... Anyway, if anyone could help with this it would be great.
Code:
#ifdef STRICT
#if !defined(NOTEXTMETRIC)
typedef int (CALLBACK* OLDFONTENUMPROCA)(CONST LOGFONTA *, CONST TEXTMETRICA *, DWORD, LPARAM);
typedef int (CALLBACK* OLDFONTENUMPROCW)(CONST LOGFONTW *, CONST TEXTMETRICW *, DWORD, LPARAM);
#ifdef UNICODE
#define OLDFONTENUMPROC OLDFONTENUMPROCW
#else
#define OLDFONTENUMPROC OLDFONTENUMPROCA
#endif // !UNICODE
#else
typedef int (CALLBACK* OLDFONTENUMPROCA)(CONST LOGFONTA *, CONST VOID *, DWORD, LPARAM);
typedef int (CALLBACK* OLDFONTENUMPROCW)(CONST LOGFONTW *, CONST VOID *, DWORD, LPARAM);
#ifdef UNICODE
#define OLDFONTENUMPROC OLDFONTENUMPROCW
#else
#define OLDFONTENUMPROC OLDFONTENUMPROCA
#endif // !UNICODE
#endif
typedef OLDFONTENUMPROCA FONTENUMPROCA;
typedef OLDFONTENUMPROCW FONTENUMPROCW;
#ifdef UNICODE
typedef FONTENUMPROCW FONTENUMPROC;
#else
typedef FONTENUMPROCA FONTENUMPROC;
#endif // UNICODE
-
Jan 15th, 2003, 10:27 AM
#2
I suppose MS f***ed up. They seem to have reused the name FONTENUMPROC even though the parameters aren't correct. The only (bad) solution is to cast:
C:
EnumFontFamiliesEx(hdc, &lf, (FONTENUMPROC)YourProc, lP, 0);
C++:
EnumFontFamiliesEx(hdc, &lf, reinterpret_cast<FONTENUMPROC>(YourProc), lP, 0);
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 15th, 2003, 10:31 AM
#3
Thread Starter
Member
Yah, that was my only solution to this problem. I thought I may have been overlooking something obvious. I'm updating my PSDK right now... I wonder if they have noticed/fixed it yet...
I figured there would have been an ENUMFONTPROCEX or something, but couldn't seem to find one.
-
Jan 15th, 2003, 10:35 AM
#4
Thread Starter
Member
No go on the update situation. Guess it's time to cast, and hope for the best.
-
Jan 15th, 2003, 11:28 AM
#5
Thread Starter
Member
So I casted and it works... even though this is just bad. Oh well... I'll make sure to document it, so that people who later maybe maintaining this won't think I'm a complete moron.
Any idea why some of the enumerated fonts come back with an '@' in there name. Like it returns @Terminal, and Terminal... What's the difference between the two?
-
Jan 15th, 2003, 06:07 PM
#6
No idea. Maybe it's documented somewhere in MSDN.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|