News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Colored menu/status bar

Started by clamicun, May 16, 2019, 09:06:09 AM

Previous topic - Next topic

clamicun

Finally,
the experts said there is no way to change the color of a a menubar.
There is. And it is quite easy.
Runs on windows 10 Home 64b.

clamicun


this one does it directly.
Don't know why.

hutch--

Runs OK here on Win10 64 Pro.

clamicun

hutch,
good to know.

The  thing is to set the first popupmenu  (only the first !) as MF_POPUP or MF_BITMAP or MF_OWNERDRAW.
The bmp is not important. In my case it only sets the menubar to 25 pixels.
Not even an expert like jj  ("Colouring the menu bar is not foreseen in Windows afaik)
knew of this easy possibility.

jj2007

Congrats, the last version works fine :t

clamicun

jj,
it is almost too easy.
The first and only MF_OWNERDRAW causes the SetMenuInfo function to set the background color of the menubar

mov mi.fMask,MIM_BACKGROUND
mov eax,hBrush
mov mi.hbrBack,eax     

Now, in my project I would like to replace all
invoke AppendMenu, ebx,MF_POPUP,esi,chr$("&First popup") .....
with
invoke AppendMenu, ebx,MF_POPUP or MF_BITMAP,esi,bitmaphandle

And to  provide the bmps with tooltips
Working on that

TimoVJL

A good trick :t

...
hBM1x16 = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(8001));
...
hMenu = CreateMenu();
AppendMenu(hMenu, MF_ENABLED | MF_POPUP | MF_OWNERDRAW | MF_BITMAP, (UINT)0, (LPCTSTR)hBM1x16);
hMenuF = CreatePopupMenu();
AppendMenu(hMenuF, MF_ENABLED | MF_STRING, IDM_EXIT, TEXT("&Exit"));
AppendMenu(hMenu, MF_ENABLED | MF_POPUP | MF_OWNERDRAW, (UINT)hMenuF, TEXT("&File"));
SetMenu(hWnd, hMenu);
May the source be with you

clamicun

Last version.
Found out. If you provide the submenus with a bitmap instead of text, the bitmap gets real strange on click , but works fine