Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

WM_SETFONT on LISTBOX

195 views
Skip to first unread message

top

unread,
Apr 28, 2004, 4:53:19 AM4/28/04
to
When I sent WM_SETFONT to EDITTEXT with some font it’s ok
But When I sent WM_SETFONT to LISTBOX or COMBOBOX it’s working only on WIN98
not on WIN2000 or WINXP
May be UNICODE problem?
Any suggestion?
Thank you


David Lowndes

unread,
Apr 28, 2004, 5:55:06 AM4/28/04
to

Show us a short example of your code.

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq

top

unread,
May 3, 2004, 5:41:29 AM5/3/04
to
thank you
the example is simple, after loading the font by:
hFont = CreateFontIndirect (&lf);
i send the id the font by:
SendDlgItemMessage (hDlg, wParam, WM_SETFONT, (WPARAM) hFont, (LPARAM)
MAKELONG ((WORD) 1, 0));
the code working correctly on win98 and on win2000 and xp only on edittext
not listbox

"David Lowndes" <dav...@example.invalid> wrote in message
news:nqvu80lpoec9hio57...@4ax.com...

David Lowndes

unread,
May 3, 2004, 6:10:56 PM5/3/04
to
>the example is simple, after loading the font by:
>hFont = CreateFontIndirect (&lf);
>i send the id the font by:
>SendDlgItemMessage (hDlg, wParam, WM_SETFONT, (WPARAM) hFont, (LPARAM)
>MAKELONG ((WORD) 1, 0));
>the code working correctly on win98 and on win2000 and xp only on edittext
>not listbox

I can't reproduce a problem on XP. I've created a dialog box with an
edit control and list box and used this code:

case WM_INITDIALOG:
SendDlgItemMessage( hDlg, IDC_LIST1, LB_ADDSTRING, 0, (LPARAM)
_T( "Item 1 " ));
SendDlgItemMessage( hDlg, IDC_LIST1, LB_ADDSTRING, 0, (LPARAM)
_T( "Item 2 " ) );
{
HFONT hFnt = (HFONT) SendDlgItemMessage( hDlg,
IDC_EDIT1, WM_GETFONT, 0, 0 );

LOGFONT lf;

GetObject( hFnt, sizeof( lf ), &lf );
lf.lfItalic = true;
HFONT hf = CreateFontIndirect( &lf );
SendDlgItemMessage( hDlg, IDC_EDIT1, WM_SETFONT,
(WPARAM) hf, 1 );
SendDlgItemMessage( hDlg, IDC_LIST1, WM_SETFONT, (WPARAM) hf,
1 );
}
return TRUE;

I've tried MBCS and Unicode builds with an without XP themes and it
works OK for me.

What's different in your situation?

0 new messages