Dark theme for 64-bit context menu
Posted: 19 Mar 2022 08:27
Hello. Is there a dark theme planned for the 64-bit context menu?
Forum for XYplorer Users and Developers
https://www.xyplorer.com/xyfc2/
I copied the AHK v1.1 sample code and used it in the AHK v2 script, if it works for the shell menu we can get the dark theme for 64-bit context menu.Horst wrote: ↑19 Mar 2022 12:31 Its an Autohotkey script.
The following contains some interesting code examples.
May be Don can have a look.
https://www.autohotkey.com/boards/viewtopic.php?t=94661
Code: Select all
xyPath := "D:\XYplorer\XYplorer.exe"
;==================================================================================================
; Dark theme
;==================================================================================================
; Dark mode (Required Windows 10 version)
uxtheme := DllCall("GetModuleHandle", "str", "uxtheme", "ptr")
SetPreferredAppMode := DllCall("GetProcAddress", "ptr", uxtheme, "ptr", 135, "ptr")
FlushMenuThemes := DllCall("GetProcAddress", "ptr", uxtheme, "ptr", 136, "ptr")
DllCall(SetPreferredAppMode, "int", 1) ; Dark
DllCall(FlushMenuThemes)
; Switch from dark to not dark
/*
DllCall(SetPreferredAppMode, "int", 0) ; NOT Dark
DllCall(FlushMenuThemes)
*/
;==================================================================================================
; Create a popup menu
;==================================================================================================
; Create main menu
MyMenu := Menu()
MyMenu.Name := "Main menu" ; Used to show which menu is selected
; Add menu item
MyMenu.Add "Item 1", MenuHandler
if FileExist(xyPath)
MyMenu.SetIcon("Item 1", xyPath) ; Add icon to first menu item if icon file exists
MyMenu.Add "Item 2", MenuHandler ; Add a second menu item
MyMenu.Add ; Add a separator line
; Add submenu
Submenu1 := Menu()
Submenu1.Name := "Submenu1" ; Used to show which menu is selected
; Add items to submenu
Submenu1.Add "Submenu item 1", MenuHandler
Submenu1.Add "Submenu item 2", MenuHandler
; Create a submenu in the main menu
MyMenu.Add "Submenu1", Submenu1
MyMenu.Add ; Add a separator line
MyMenu.Add "Item 3", MenuHandler ; Add a third menu item
MyMenu.Default := "Item 1"
MenuHandler(Item, ItemPos, MyMenu) {
MsgBox "You selected " Item " (position " ItemPos " in " MyMenu.Name ")"
}
MyMenu.Show