Wonderful, thanks guys, I've wanted dark menus from the taskbar for a while and randomly decided to search for a solution.
In my case, all my workstations are set up as Light "app mode", Dark "window mode" (ie dark taskbar, see screenshot), which yielded the dark menu solution in this thread non-functional.
The reason for this is that in older builds of Windows 10, the option was
AllowDarkModeForWindow and boolean, but the
SetPreferredAppMode options are something like:
Code: Select all
0=Default
1=AllowDark
2=ForceDark
3=ForceLight
4=Max
So with my config, the API considers it still "light", but when my menu comes from the taskbar i want it to be dark like the other taskbar menus, so
DllCall(SetPreferredAppMode, "int", 2) forces dark when I want it by using "2". 3 is obvious, and I haven't tried 4 yet to see what max means, but hopefully someone will find this useful.
Code: Select all
Menu_Dark(2)
Menu, Tray, Show
Menu_Dark(d) { ; 0=Default 1=AllowDark 2=ForceDark 3=ForceLight 4=Max
global Name, MenuIconSize
static uxtheme := DllCall("GetModuleHandle", "str", "uxtheme", "ptr")
static SetPreferredAppMode := DllCall("GetProcAddress", "ptr", uxtheme, "ptr", 135, "ptr")
static FlushMenuThemes := DllCall("GetProcAddress", "ptr", uxtheme, "ptr", 136, "ptr")
DllCall(SetPreferredAppMode, "int", d) ; 0=Default 1=AllowDark 2=ForceDark 3=ForceLight 4=Max
DllCall(FlushMenuThemes)
}