win32 - can i change the menu bar HFONT?

Oct 17, 2016 at 4:28pm
it's possible change the menu bar HFONT without ownerdraw it?
i can change the popup backcolor and background image, but can i change it's HFONT?
Oct 17, 2016 at 10:05pm
Did you try SendMessage(hMenu, WM_SETFONT,.....);
Oct 18, 2016 at 6:00pm
i see 2 thigs:
1 - the 1st parameter it's a HWND and not HMENU, unless accept it?
2 - i don't know the WPARAM and LPARAM, can you advice more?
Oct 18, 2016 at 6:24pm
1
2
3
4
CHOOSEFONT cf=ShowSelectFont();
//mnuSecondHello it's the menu handle:
if(SendMessage((HWND)(HMENU)mnuSecondHello, WM_SETFONT,(WPARAM) cf.lpLogFont,NULL)!=WM_SETFONT)
                MessageBox(to_string(GetLastError()),"error message");

error: 1400:
"ERROR_INVALID_WINDOW_HANDLE

1400 (0x578)

Invalid window handle."
Oct 18, 2016 at 7:05pm
i found 1 nice way for it:
1
2
3
4
5
6
7
8
9
10
CHOOSEFONT cf={0};
NONCLIENTMETRICS theMetrics;

            theMetrics.cbSize = sizeof(NONCLIENTMETRICS);

            SystemParametersInfo(SPI_GETNONCLIENTMETRICS,sizeof(NONCLIENTMETRICS),
                            (PVOID) &theMetrics,0);
            theMetrics.lfMenuFont=*cf.lpLogFont;
            SystemParametersInfo(SPI_SETNONCLIENTMETRICS,sizeof(NONCLIENTMETRICS),
                            (PVOID) &theMetrics,0);

the font it's changed but not only on Window of application, but all windows on OS. can anyone advice me?
Oct 18, 2016 at 11:03pm
My idea doesn't work. I tried it too. Would have been nice and easy if it did. But I guess its fairly complicated, cuz the size of the menu bar has to change too. Owner Draw might be only way to do it, like you said.
Topic archived. No new replies allowed.