News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Popup Menu

Started by clamicun, April 09, 2019, 12:16:59 AM

Previous topic - Next topic

jj2007

Hallo Mic,

Colouring the menu bar is not foreseen in Windows afaik. I vaguely remember to have read somewhere that "menus are windows", so they might have a WndProc and a WM_ERASEBGND message, but Google is not my friend tonight :(

Good luck and Happy Easter :icon14:

Biterider

Hi clamicun
I'm not sure what you want to do. I send you a demo where I used the the "Owner Draw" method to customize the menu drawing.
In this particular example, I painted the "Help" main menu item with the COLOR_GRADIENTACTIVECAPTION system color.

If this is what you want, I can provide you the source to adapt it to your project  :P

Regards, Biterider

aw27

Quote from: jj2007 on April 22, 2019, 07:09:33 AM
I vaguely remember to have read somewhere that "menus are windows", so they might have a WndProc and a WM_ERASEBGND message
What you might have read was "Menu of windows" not "Menu are windows".  A little word that changes the whole case.
This does not mean it can't be painted. All you need is a brush.  :t

jj2007

Quote from: Biterider on April 22, 2019, 03:50:41 PMI send you a demo where I used the the "Owner Draw" method to customize the menu drawing.

Impressive :t

clamicun

jj,
thanks a lot.
Finally a satisfactory answer. This explains the many unsuccessful attempts in several programming languages.
Have a good one
Mic

TimoVJL

mov mi.fMask,MIM_BACKGROUND or MIM_APPLYTOSUBMENUS
and the result was yellow.
But you wanted something else ?
May the source be with you

clamicun

TimoVJL,
that is exactly what I want. Not necessarily the dropdownmenu (MIM_APPLYTOSUBMENUS)
but the menubar.
How did you do that ?
Whatever I do, only the dropdownmenu gets the color of the brush

TimoVJL

#52
I was using a Windows Classic theme, so it's a theme problem with menu.

EDIT: SetWindowTheme(hWnd, L"", L"");
EDIT: sUXT db "UxTheme.dll",0
sFunc db "SetWindowTheme",0
swNull dw 0
Wnd dd ?

.code
start:
INVOKE LoadLibraryA, ADDR sUXT
.if eax
INVOKE GetProcAddress, eax, ADDR sFunc
.if eax
push OFFSET swNull
push OFFSET swNull
push [Wnd]
call eax
.endif
.endif
May the source be with you

HSE

Quote from: TimoVJL on April 22, 2019, 09:56:47 PM
I was using a Windows Classic theme
I "discover" yesterday that Menu SystemColors don't work with Aero theme I have  :biggrin:
Equations in Assembly: SmplMath

Biterider

Hi
Passing a brush to the SetMenuInfo API, it is perfectly possible to draw on the complete MenuBar and there is no need to change the windows theme settings.
Tested on Win 10 & Win7.

Regards, Biterider

HSE

Just random luck: the menubar have colors if you disable visual themes in binary compatibility properties  :t
Equations in Assembly: SmplMath

clamicun

Hi Biterider,

???  7-Zip
OwnerDraw.zip
Die Datei kann nicht geöffnet werden
Can't open file
Ist kein Archiv
It isn't an arquive

Biterider

Hi Clamicun
OwnerDraw.zip is a jpg file renamed to .zip, so that the forum SW can display it.

Regards, Biterider

Biterider

Hi
I'm playing with this implementation to let the MenuBar flash asynchroniously to get the users attention.
I modified the code to trigger the flashing when a new MDI client window is created or the help or about dialog are shown.  8)

Regards, Biterider

clamicun

jj,
what is this ?

http://vbnet.mvps.org/index.html?code/menu/menucolour.htm