Author Topic: Popup Menu  (Read 4468 times)

jj2007

  • Member
  • *****
  • Posts: 10088
  • Assembler is fun ;-)
    • MasmBasic
Re: Popup Menu
« Reply #45 on: April 22, 2019, 07:09:33 AM »
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

  • Member
  • ***
  • Posts: 459
  • ObjAsm32 + ObjAsm64 = ObjAsm
    • ObjAsm
Re: Popup Menu
« Reply #46 on: April 22, 2019, 03:50:41 PM »
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

AW

  • Member
  • *****
  • Posts: 2563
  • Let's Make ASM Great Again!
Re: Popup Menu
« Reply #47 on: April 22, 2019, 04:07:10 PM »
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

  • Member
  • *****
  • Posts: 10088
  • Assembler is fun ;-)
    • MasmBasic
Re: Popup Menu
« Reply #48 on: April 22, 2019, 04:42:58 PM »
I send you a demo where I used the the "Owner Draw" method to customize the menu drawing.

Impressive :t

clamicun

  • Member
  • ***
  • Posts: 347
Re: Popup Menu
« Reply #49 on: April 22, 2019, 06:51:31 PM »
jj,
thanks a lot.
Finally a satisfactory answer. This explains the many unsuccessful attempts in several programming languages.
Have a good one
Mic

TimoVJL

  • Member
  • ***
  • Posts: 494
Re: Popup Menu
« Reply #50 on: April 22, 2019, 08:04:35 PM »
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

  • Member
  • ***
  • Posts: 347
Re: Popup Menu
« Reply #51 on: April 22, 2019, 09:14:38 PM »
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

  • Member
  • ***
  • Posts: 494
Re: Popup Menu
« Reply #52 on: April 22, 2019, 09:56:47 PM »
I was using a Windows Classic theme, so it's a theme problem with menu.

EDIT: SetWindowTheme(hWnd, L"", L"");
EDIT:
Code: [Select]
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
« Last Edit: May 05, 2019, 08:57:49 PM by TimoVJL »
May the source be with you

HSE

  • Member
  • *****
  • Posts: 1245
  • <AMD>< 7-32>
Re: Popup Menu
« Reply #53 on: April 22, 2019, 11:19:15 PM »
I was using a Windows Classic theme
I "discover" yesterday that Menu SystemColors don't work with Aero theme I have  :biggrin:

Biterider

  • Member
  • ***
  • Posts: 459
  • ObjAsm32 + ObjAsm64 = ObjAsm
    • ObjAsm
Re: Popup Menu
« Reply #54 on: April 23, 2019, 06:32:48 AM »
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

  • Member
  • *****
  • Posts: 1245
  • <AMD>< 7-32>
Re: Popup Menu
« Reply #55 on: April 23, 2019, 09:31:24 AM »
Just random luck: the menubar have colors if you disable visual themes in binary compatibility properties  :t

clamicun

  • Member
  • ***
  • Posts: 347
Re: Popup Menu
« Reply #56 on: April 23, 2019, 05:58:55 PM »
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

  • Member
  • ***
  • Posts: 459
  • ObjAsm32 + ObjAsm64 = ObjAsm
    • ObjAsm
Re: Popup Menu
« Reply #57 on: April 23, 2019, 06:03:26 PM »
Hi Clamicun
OwnerDraw.zip is a jpg file renamed to .zip, so that the forum SW can display it.

Regards, Biterider

Biterider

  • Member
  • ***
  • Posts: 459
  • ObjAsm32 + ObjAsm64 = ObjAsm
    • ObjAsm
Re: Popup Menu
« Reply #58 on: April 23, 2019, 06:42:26 PM »
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

  • Member
  • ***
  • Posts: 347
Re: Popup Menu
« Reply #59 on: April 23, 2019, 07:05:59 PM »