WildByDesign Posted October 16, 2025 Author Posted October 16, 2025 4 hours ago, argumentum said: Hope this helps Absolutely. Thank you so much for confirming. argumentum 1
WildByDesign Posted October 20, 2025 Author Posted October 20, 2025 I just wanted to take a moment to thank everyone again who helped with this issue. I've completed the part of the project that relates to the menubar. I actually ended up coloring that line in such a way that it gives the GUI some depth and also made the statusbar sizing and style to match it. When I started learning AutoIt a little over a year ago, I never thought that such beautiful GUIs could be made. I was able to make that line semi-transparent along with the rest of the GUI so that it does the blur behind well and also the Windows 11 materials (Mica, Acrylic, etc.) Cheers everyone! 🍷 ioa747, argumentum and UEZ 3
argumentum Posted October 20, 2025 Posted October 20, 2025 It is a pleasure to see people getting the hang of it and realizing their visions 🍷 WildByDesign 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
bladem2003 Posted October 21, 2025 Posted October 21, 2025 (edited) wow... would you publish the source code??? Edited October 21, 2025 by bladem2003
WildByDesign Posted October 21, 2025 Author Posted October 21, 2025 11 minutes ago, bladem2003 said: would you publish the source code??? The latest source code is here (GitHub) and there is also a thread here (in AutoIt forums). The thread is undo the original title of DwmColorBlurMica and the source in that thread is a version behind at the moment. I have to update it soon. But the GitHub repo always has the latest. bladem2003 1
WildByDesign Posted January 2 Author Posted January 2 (edited) So I have discovered (by accident) what is probably a much more efficient way to color that white line that affects win32 menubars in dark mode. I realized that using _WinAPI_SetSysColors on COLOR_MENU was filling that exact white line. It's very interesting because in Win10/11, COLOR_MENU and many other elements are color by the msstyles theme engine and the vast majority of elements no longer work. It seems that the white line is part of the menu that gets missed by the theme, whether it's a bug or not. Even though SetSysColors is system-wide and affects all running programs during that session, using COLOR_MENU is not harmful since it doesn't actually color the menus or menubar in any way in Win10/11. Those are all enforced through the msstyles theme engine. In my opinion, this should be better and safer than painting over the non-client area which I have been doing for a while now. Painting over the non-client area works quite well, but it has cause some conflicts in specific scenarios for me. @UEZ This may be useful as an alternative for your _OverpaintWhiteLine() functionality in your SampleControls.au3 in Dark Mode script if you wish. It can cut out a lot of code and complexity while also completely eliminating any occasional flicker of that white line. Changes: ... ; on script startup Global $iColorNew = 0x202020 Global $iColorOld = _WinAPI_GetSysColor($COLOR_MENU) ; set COLOR_MENU system color _WinAPI_SetSysColors($COLOR_MENU, $iColorNew) ... ; on script exit (after GUIDelete) ; reset COLOR_MENU system color _WinAPI_SetSysColors($COLOR_MENU, $iColorOld) Full Example: expandcollapse popup#include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <WinAPITheme.au3> #include "GUIDarkMode_v0.02mod.au3" #include "ModernMenuRaw.au3" Global $iColorNew = 0x202020 Global $iColorOld = _WinAPI_GetSysColor($COLOR_MENU) ; set COLOR_MENU system color _WinAPI_SetSysColors($COLOR_MENU, $iColorNew) DllCall("User32.dll", "bool", "SetProcessDpiAwarenessContext" , "HWND", "DPI_AWARENESS_CONTEXT" -4) _SetMenuBkColor(0x202020) _SetMenuIconBkColor(0x202020) _SetMenuIconBkGrdColor(0x202020) _SetMenuSelectBkColor(0x202020) _SetMenuSelectRectColor(0x202020) _SetMenuSelectTextColor(0xFFFFFF) _SetMenuTextColor(0xFFFFFF) Example() Func Example() $hGUI = GUICreate("My GUI", 300, 200) ;Local $idFileMenu = GUICtrlCreateMenu("&File") Local $idFileMenu = _GUICtrlCreateODTopMenu("&File", $hGUI) GUICtrlCreateMenuItem("&Open", $idFileMenu) GUICtrlCreateMenuItem("&Save", $idFileMenu) GUICtrlCreateMenuItem("", $idFileMenu) Local $idOptionsMenu = GUICtrlCreateMenu("O&ptions", $idFileMenu) GUICtrlCreateMenuItem("View", $idOptionsMenu) GUICtrlCreateMenuItem("", $idOptionsMenu) GUICtrlCreateMenuItem("Tools", $idOptionsMenu) GUICtrlCreateMenuItem("", $idFileMenu) Local $idExitItem = GUICtrlCreateMenuItem("&Exit", $idFileMenu) ;Local $idHelpMenu = GUICtrlCreateMenu("&?") Local $idHelpMenu = _GUICtrlCreateODTopMenu("&?", $hGUI) Local $idAboutItem = GUICtrlCreateMenuItem("&About", $idHelpMenu) Local $idEndBtn = GUICtrlCreateButton("End", 110, 140, 70, 20) GuiDarkmodeApply($hGUI) GUISetState(@SW_SHOW) Local $idMsg ; Loop until the user exits. While 1 $idMsg = GUIGetMsg() Switch $idMsg Case $idExitItem, $idEndBtn, $GUI_EVENT_CLOSE ExitLoop Case $idAboutItem MsgBox($MB_SYSTEMMODAL, "About...", "Colored menu sample") EndSwitch WEnd GUIDelete($hGUI) ; reset COLOR_MENU system color _WinAPI_SetSysColors($COLOR_MENU, $iColorOld) EndFunc ;==>Example Edited January 2 by WildByDesign
WildByDesign Posted Tuesday at 06:32 PM Author Posted Tuesday at 06:32 PM On 1/2/2026 at 7:06 AM, WildByDesign said: I realized that using _WinAPI_SetSysColors on COLOR_MENU was filling that exact white line. It's very interesting because in Win10/11, COLOR_MENU and many other elements are color by the msstyles theme engine and the vast majority of elements no longer work. I wanted to follow up on this and provide a better option. The reason why I was searching for another method for painting that white line (dark mode only) under the menubar is because the combination of having a GUI that can resize (specifically $WS_SIZEBOX) was clashing with the custom dark mode statusbar from @pixelsearch. The ownerdrawn dark mode statusbar uses a ScrollbarProc with $SBS_SIZEBOX. The combination of the two things would cause the entire frame of the GUI to lose its theme completely like Windows Classic theme. SetSysColors did end causing some minor visual weirdness given that it is system-wide. So that got me digging into the cause of the initial problem and I finally figured it out without having to reach out for help in the forum, so I am happy about that. The part from the original script from @ahmet for painting the white line utilized WM_NCPAINT and that was the source of the issue. It turns out that WM_NCPAINT wasn't needed after all. I removed that and the issue went away. I ended up adding WM_WINDOWPOSCHANGED to handle size or position changes. Here is the latest script: expandcollapse popup#include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <WinAPITheme.au3> #include <WinAPIGdi.au3> #include <WinAPISysWin.au3> #include <GuiMenu.au3> #include <Array.au3> #include <WinAPIDiag.au3> #include <WinAPIConv.au3> #include <WinAPIGdiDC.au3> ; DPI must be set before menu measurements DllCall("User32.dll", "bool", "SetProcessDpiAwarenessContext", "HWND", "DPI_AWARENESS_CONTEXT" - 2) #include "ModernMenuRaw.au3" ; WA_ACTIVATE constants Global Const $WA_INACTIVE = 0x0000 Global Const $WA_ACTIVE = 0x0001 Global Const $WA_CLICKACTIVE = 0x0002 Global $hGUI ;Coded by UEZ build 2025-10-10 ;IMMERSIVE_HC_CACHE_MODE Enum $IHCM_USE_CACHED_VALUE, $IHCM_REFRESH Enum $Default, $AllowDark, $ForceDark, $ForceLight, $Max ;$iPreferredAppMode ;~ Enum $DWMWA_USE_IMMERSIVE_DARK_MODE = (@OSBuild <= 18985) ? 19 : 20 _SetMenuBkColor(0x000000) _SetMenuIconBkColor(0x000000) _SetMenuIconBkGrdColor(0x000000) _SetMenuSelectBkColor(0x202020) _SetMenuSelectRectColor(0x202020) _SetMenuSelectTextColor(0xFFFFFF) _SetMenuTextColor(0xFFFFFF) Example() Func Example() $hGUI = GUICreate("My GUI", 600, 400, -1, -1, $WS_SIZEBOX + $WS_SYSMENU + $WS_MINIMIZEBOX + $WS_MAXIMIZEBOX) GUISetBkColor(0x000000) ;Local $idFileMenu = GUICtrlCreateMenu("&File") Local $idFileMenu = _GUICtrlCreateODTopMenu("&File", $hGUI) GUICtrlCreateMenuItem("&Open", $idFileMenu) GUICtrlCreateMenuItem("&Save", $idFileMenu) GUICtrlCreateMenuItem("", $idFileMenu) Local $idOptionsMenu = GUICtrlCreateMenu("O&ptions", $idFileMenu) GUICtrlCreateMenuItem("View", $idOptionsMenu) GUICtrlCreateMenuItem("", $idOptionsMenu) GUICtrlCreateMenuItem("Tools", $idOptionsMenu) GUICtrlCreateMenuItem("", $idFileMenu) Local $idExitItem = GUICtrlCreateMenuItem("&Exit", $idFileMenu) Local $idHelpMenu = _GUICtrlCreateODTopMenu("&?", $hGUI) Local $idAboutItem = GUICtrlCreateMenuItem("&About", $idHelpMenu) Global $hSolidBrush = _WinAPI_CreateBrushIndirect($BS_SOLID, 0x000000) GUIRegisterMsg($WM_ACTIVATE, "WM_ACTIVATE_Handler") GUIRegisterMsg($WM_WINDOWPOSCHANGED, "WM_WINDOWPOSCHANGED_Handler") _WinAPI_AllowDarkModeForApp(True) _WinAPI_RefreshImmersiveColorPolicyState() _WinAPI_FlushMenuThemes() _WinAPI_DwmSetWindowAttribute__($hGUI, 20, 1) _WinAPI_DwmExtendFrameIntoClientArea($hGUI, _WinAPI_CreateMargins(-1, -1, -1, -1)) GUISetState(@SW_SHOW) _drawUAHMenuNCBottomLine($hGUI) Local $idMsg ; Loop until the user exits. While 1 $idMsg = GUIGetMsg() Switch $idMsg Case $idExitItem, $GUI_EVENT_CLOSE _WinAPI_DeleteObject($hSolidBrush) ExitLoop Case $idAboutItem MsgBox($MB_SYSTEMMODAL, "About...", "Colored menu sample") EndSwitch WEnd EndFunc ;==>Example Func _drawUAHMenuNCBottomLine($hWnd) ; ahmet $rcClient = _WinAPI_GetClientRect($hWnd) Local $aCall = DllCall('user32.dll', "int", "MapWindowPoints", _ "hwnd", $hWnd, _ ; hWndFrom "hwnd", 0, _ ; hWndTo "ptr", DllStructGetPtr($rcClient), _ "uint", 2) ;number of points - 2 for RECT structure $rcWindow = _WinAPI_GetWindowRect($hWnd) _WinAPI_OffsetRect($rcClient, -$rcWindow.left, -$rcWindow.top) $rcAnnoyingLine = DllStructCreate($tagRECT) $rcAnnoyingLine.left = $rcClient.left $rcAnnoyingLine.top = $rcClient.top $rcAnnoyingLine.right = $rcClient.right $rcAnnoyingLine.bottom = $rcClient.bottom $rcAnnoyingLine.bottom = $rcAnnoyingLine.top $rcAnnoyingLine.top = $rcAnnoyingLine.top - 1 $hRgn=_WinAPI_CreateRectRgn(0,0,8000,8000) $hDC=_WinAPI_GetDCEx($hWnd,$hRgn, BitOR($DCX_WINDOW,$DCX_INTERSECTRGN)) _WinAPI_FillRect($hDC, $rcAnnoyingLine, $hSolidBrush) _WinAPI_ReleaseDC($hWnd, $hDC) EndFunc ;==>_drawUAHMenuNCBottomLine ; ioa747 Func WM_ACTIVATE_Handler($hWnd, $MsgID, $wParam, $lParam) _drawUAHMenuNCBottomLine($hGUI) Return $GUI_RUNDEFMSG EndFunc Func WM_WINDOWPOSCHANGED_Handler($hWnd, $iMsg, $wParam, $lParam) If $hWnd <> $hGUI Then Return $GUI_RUNDEFMSG _drawUAHMenuNCBottomLine($hWnd) Return $GUI_RUNDEFMSG EndFunc ;==>_WM_WINDOWPOSCHANGED ; UEZ Func _WinAPI_ShouldAppsUseDarkMode() Local $aResult = DllCall("UxTheme.dll", "bool", 132) If @error Then Return SetError(1, 0, False) Return ($aResult[0] <> 0) EndFunc ;==>_WinAPI_ShouldAppsUseDarkMode Func _WinAPI_AllowDarkModeForWindow($hWND, $bAllow = True) Local $aResult = DllCall("UxTheme.dll", "bool", 133, "hwnd", $hWND, "bool", $bAllow) If @error Then Return SetError(1, 0, False) Return ($aResult[0] <> 0) EndFunc ;==>_WinAPI_AllowDarkModeForWindow Func _WinAPI_AllowDarkModeForApp($bAllow = True) ;Windows 10 Build 17763 Return _WinAPI_SetPreferredAppMode($bAllow ? 1 : 0) ; 1 = AllowDark, 0 = Default EndFunc ;==>_WinAPI_AllowDarkModeForApp Func _WinAPI_SetPreferredAppMode($iPreferredAppMode) ;Windows 10 Build 18362+ Local $aResult = DllCall("UxTheme.dll", "long", 135, "long", $iPreferredAppMode) If @error Then Return SetError(1, 0, False) Return $aResult[0] EndFunc ;==>_WinAPI_SetPreferredAppMode Func _WinAPI_FlushMenuThemes() Local $aResult = DllCall("UxTheme.dll", "none", 136) If @error Then Return SetError(1, 0, False) Return True EndFunc ;==>_WinAPI_FlushMenuThemes Func _WinAPI_RefreshImmersiveColorPolicyState() Local $aResult = DllCall("UxTheme.dll", "none", 104) If @error Then Return SetError(1, 0, False) Return True EndFunc ;==>_WinAPI_RefreshImmersiveColorPolicyState Func _WinAPI_IsDarkModeAllowedForWindow($hWND) Local $aResult = DllCall("UxTheme.dll", "bool", 137, "hwnd", $hWND) If @error Then Return SetError(1, 0, False) Return ($aResult[0] <> 0) EndFunc ;==>_WinAPI_IsDarkModeAllowedForWindow Func _WinAPI_GetIsImmersiveColorUsingHighContrast($iIMMERSIVE_HC_CACHE_MODE) Local $aResult = DllCall("UxTheme.dll", "bool", 106, "long", $iIMMERSIVE_HC_CACHE_MODE) If @error Then Return SetError(1, 0, False) Return ($aResult[0] <> 0) EndFunc ;==>_WinAPI_GetIsImmersiveColorUsingHighContrast Func _WinAPI_OpenNcThemeData($hWND, $tClassList) Local $aResult = DllCall("UxTheme.dll", "hwnd", 49, "hwnd", $hWND, "struct*", $tClassList) If @error Then Return SetError(1, 0, False) Return $aResult[0] EndFunc ;==>_WinAPI_OpenNcThemeData Func _WinAPI_ShouldSystemUseDarkMode() Local $aResult = DllCall("UxTheme.dll", "bool", 138) If @error Then Return SetError(1, 0, False) Return ($aResult[0] <> 0) EndFunc ;==>_WinAPI_ShouldSystemUseDarkMode Func _WinAPI_IsDarkModeAllowedForApp() Local $aResult = DllCall("UxTheme.dll", "bool", 139) If @error Then Return SetError(1, 0, False) Return ($aResult[0] <> 0) EndFunc ;==>_WinAPI_IsDarkModeAllowedForApp Func _WinAPI_DwmSetWindowAttribute__($hwnd, $attribute = 34, $value = 0x00FF00, $valLen = 4) Local $aCall = DllCall('dwmapi.dll', 'long', 'DwmSetWindowAttribute', 'hwnd', $hWnd, 'dword', $attribute, 'dword*', $value, 'dword', $valLen) If @error Then Return SetError(@error, @extended, 0) If $aCall[0] Then Return SetError(10, $aCall[0], 0) Return 1 EndFunc ;==>_WinAPI_DwmSetWindowAttribute__ argumentum 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now