July 07, 2025, 07:40:22 PM

News:

IWBasic runs in Windows 11!


Set Menu Color

Started by Bruce Peaslee, August 30, 2010, 11:07:03 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bruce Peaslee

I like my windows and dialogs to be just a little darker shade of gray than standard. This causes the menu bar to stand out. Here is a little routine to change the menu color to match (or not) that of the window.

'ÂÃ,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯Ã‚Ã,¯
Sub SetMenuColor(int hWnd, int dwColor, int bIncludeSubmenus)
'_________________________________________________________________________________________________________________



MENUINFO mi
int flags

flags  = MIM_BACKGROUND

if bIncludeSubmenus
flags = flags | MIM_APPLYTOSUBMENUS
endif

mi.cbSize = len(mi)
mi.fmask = flags
mi.hbrBack = CreateSolidBrush(dwColor)

SetMenuInfo(GetMenu(hWnd), mi)

DrawMenuBar(hWnd)

EndSub

'Usage

SetMenuColor(wMain, RGB(175,175,175), true)

Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

Guilect

Thanks for sharing.
This goes into the snippets bucket until such time it gets used.   :)

jerryclement

QuoteThanks for sharing.
This goes into the snippets bucket until such time it gets used.   

Thanks Peaslee,
Jerry C
Jerry - Newbie from TN