Look at this Function I made:
You notice the second call of CreateFont? It's completely unneccessary, you mean? Well, if you ask me, I'd say the same. BUT. Without this line the function doesn't work. It just does nothing if I cut this unlogical 2nd call of CreateFont. And now I'm wondering why!Code:BOOL SetWFont( HWND handle, UINT winIdent, UINT fontSize, LPSTR fontFamily ) { HFONT hFont; HDC hdc; long lfHeight; hdc = GetDC(handle); lfHeight = -MulDiv(fontSize, GetDeviceCaps(hdc, LOGPIXELSY), 72); ReleaseDC(handle, hdc); hFont = CreateFont(lfHeight, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, fontFamily); if(!SendDlgItemMessage(handle, winIdent, WM_SETFONT, (WPARAM)hFont, TRUE)) return 0; hFont = CreateFont(lfHeight, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, fontFamily); DeleteObject(hFont); return 1; }
Has anybody an idea? (well it's not that serious cause the function now works and does what I want, but I think it's strange nevertheless!)
Pry



LinkBack URL
About LinkBacks


