argumentum Posted February 3 Posted February 3 On 1/11/2025 at 8:48 AM, WildByDesign said: Those are nice themes. Personally, specifically for dark mode only, I use Rectify11 theme for Windows. Rectify11 actually fixes the problem with the ListView checkboxes. However, for the apps that I make, I end up having to target default Aero theme (dark and light) because that is what the majority of users would be using. My main PC broke So, new PC, new setup. Installed the current Rectify11 and, it messed up the PC. Patched files left an right. I went to use the registry and oops, it would not load. Therefore, uninstall it is. Nope, the uninstaller is missing. Now after a few hours of setting up my Win11-24H2, I have to erase it and install again. Warning: test in a VM and if all looks good, do the same in the hardware PC. In my experience, they are chewing more than they should try to bite. I will not try it again. There is no need to patch everything under the sun to make a decent dark theme. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
WildByDesign Posted February 3 Posted February 3 20 hours ago, argumentum said: In my experience, they are chewing more than they should try to bite. I will not try it again. There is no need to patch everything under the sun to make a decent dark theme. I agree 100% about not patching everything. I apologize that you had such a bad experience. I should have gave you more details initially but I did not want to go too far off-topic. I don't like patching digitally signed files since it breaks the signatures. So what I did was write a system tray tool in AutoIt that simply switches msstyles. So I grab the msstyles (theme files) only from Rectify11 repo and only use that. That way the system can't be broken from it since no files are being patched. Anyway, I don't want to further go off-topic here. But you can feel free to private message here in the forum anytime if you need to. argumentum 1
WildByDesign Posted April 29 Posted April 29 @argumentum I found and fixed an issue with your _HiDpi_Ctrl_LazyInit() function on 64-bit systems: Func _HiDpi_Ctrl_LazyInit($iCONTEXT = -2) ; under the current state of developnment, -2 is the best option for this UDF. If $iCONTEXT <> Null Then If Not ($iCONTEXT < -1 And $iCONTEXT > -5) Then $iCONTEXT = -2 ;DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", "int", $iCONTEXT) ; not working on 64-bit DllCall("User32.dll", "bool", "SetProcessDpiAwarenessContext" , "HWND", $iCONTEXT) ; working on 64-bit EndIf _HiDpi_CtrlSetVarDPI( _HiDpi_GetDpiForWindow()) _HiDpi_CtrlSetVarRatio(_HiDpi_CtrlSetVarDPI() / 96) EndFunc ;==>_HiDpi_Ctrl_LazyInit argumentum 1
WildByDesign Posted May 4 Posted May 4 One thing that bothered me for a while was how regular checkboxes would get the dark theme but ListView checkboxes ($LVS_EX_CHECKBOXES) would not and it would be a significant contrast. This is not a limitation of AutoIt but actually a limitation of Windows dark mode Aero theme. Before, regular checkboxes would be in dark mode and listview checkboxes would be in light mode. I have attached the dark mode checkboxes to this post and each ICO file contains all sizes (13, 16, 20, 26, 32, 40, 52 pixels). All you need is the following code after dark mode has been applied: If $isDarkMode = True Then $hImageList = _GUICtrlListView_GetImageList($hListView, 2) _GUIImageList_Remove($hImageList) _GUIImageList_AddIcon($hImageList, "unchecked.ico") _GUIImageList_AddIcon($hImageList, "checked.ico") EndIf Alternatively, you can add the icons as resources for compiled binaries like this: #AutoIt3Wrapper_Res_Icon_Add=unchecked.ico #AutoIt3Wrapper_Res_Icon_Add=checked.ico ; this part must be applied AFTER dark mode has already been set If $isDarkMode = True Then $hImageList = _GUICtrlListView_GetImageList($hListView, 2) _GUIImageList_Remove($hImageList) If @Compiled = 0 Then _GUIImageList_AddIcon($hImageList, "unchecked.ico") _GUIImageList_AddIcon($hImageList, "checked.ico") Else _GUIImageList_AddIcon($hImageList, @ScriptFullPath, 3) _GUIImageList_AddIcon($hImageList, @ScriptFullPath, 4) EndIf EndIf Screenshot: DarkModeCheckboxes.zip ioa747 and argumentum 2
argumentum Posted May 4 Posted May 4 2 hours ago, WildByDesign said: #AutoIt3Wrapper_Res_Icon_Add=unchecked.ico #AutoIt3Wrapper_Res_Icon_Add=checked.ico #AutoIt3Wrapper_Res_Icon_Add=unchecked.ico, 201 #AutoIt3Wrapper_Res_Icon_Add=checked.ico, 202 Global $g_Compiled = Int(@AutoItExe = @ScriptFullPath) ; better than @Compiled ConsoleWrite("- $g_Compiled = " & $g_Compiled & @CRLF) ; this part must be applied AFTER dark mode has already been set If $isDarkMode = True Then $hImageList = _GUICtrlListView_GetImageList($hListView, 2) _GUIImageList_Remove($hImageList) ;~ If @Compiled = 0 Then ; Returns 1 if script is a compiled executable or an .a3x file; returns 0 if an .au3 file. If $g_Compiled Then _GUIImageList_AddIcon($hImageList, @ScriptFullPath, 201) ; because it can become a game of chance as you add/remove code _GUIImageList_AddIcon($hImageList, @ScriptFullPath, 202) ; so is better to declare it. Else _GUIImageList_AddIcon($hImageList, "unchecked.ico") _GUIImageList_AddIcon($hImageList, "checked.ico") EndIf EndIf I strongly believe that declaring the resource number is better. WildByDesign 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
WildByDesign Posted May 4 Posted May 4 14 minutes ago, argumentum said: I strongly believe that declaring the resource number is better. Thank you for this. I did not know that we could specify the resource number. But now that you told me, I agree with you about declaring it. By the way, do you know of any method to programmatically obtain the checkbox images? What I mean is, not including the ICO files at all. But instead, have a dark mode regular checkbox and somehow obtain the state ImageList from that which I believe falls under button category. Then take that ImageList and apply it to the ListView state ImageList similar to my code above. I understand that a regular checkbox has more visual states compared to ListView checkbox states. So we would have to be able to select which states to apply and which to discard. We might need some super high level AutoIt gurus to help with that question. I think that if we could do this in a programmatic way it would be better. Especially if a user is using a theme other than Aero.
argumentum Posted May 4 Posted May 4 22 minutes ago, WildByDesign said: ...have a dark mode regular checkbox and somehow obtain the state ImageList from that which... I am a special type of coder. I'd call me a channeler or medium that knows what is needed and then, just like an angel, forgot, as it's all an eternal now. ( meaning that I google like a maniac, copy and paste until am done, and go to sleep, not to remember what I did because I never knew how anything works ) But maybe those that know GDI can cook an image out of code ( like in the SizeGrip code ) and that'd be nice to have. Or find a way to just change the color of the checkbox text, because after all, a checkbox is a button of sorts ( low level wise ). WildByDesign 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
UEZ Posted May 13 Posted May 13 (edited) Is there a way to check if visible GUI is in dark mode? Edit: this seems to work: ;Coded by UEZ build 2025-05-14 #include <AutoItConstants.au3> #include <StringConstants.au3> #include <WinAPISysWin.au3> Const $DWMWA_USE_IMMERSIVE_DARK_MODE = @OSBuild < 18362 ? 19 : 20 Func _WinAPI_IsWindowDarkMode($hWnd) Local $value = DllStructCreate("int dm") Local $ret = DllCall("dwmapi.dll", "long", "DwmGetWindowAttribute","hwnd", $hWnd, "uint", $DWMWA_USE_IMMERSIVE_DARK_MODE, "struct*", $value, "uint", DllStructGetSize($value)) If @error Or $ret[0] <> 0 Then Return 0 Return $value.dm <> 0 EndFunc Global $aWinList = WinList(), $i, $iStatus For $i = 1 To $aWinList[0][0] If _WinAPI_IsWindowVisible($aWinList[$i][1]) Then If IsHWnd($aWinList[$i][1]) Then $iStatus = _WinAPI_IsWindowDarkMode($aWinList[$i][1]) ConsoleWrite($aWinList[$i][1] & ": " & $iStatus & " -> " & StringRegExpReplace($aWinList[$i][0], "[\r\n]+", "") & @CRLF) EndIf EndIf Next Edited May 14 by UEZ WildByDesign and argumentum 2 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
argumentum Posted May 13 Posted May 13 29 minutes ago, UEZ said: Is there a way to check if visible GUI is in dark mode? If is visible then getting the client color and comparing FG/BG would be the way I'd do it. Then again I don't personally know a WinAPI way. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
ioa747 Posted May 14 Posted May 14 Here he is looking at the registry 211196-gui-title-bar-dark-theme-an-elegant-solution-using-dwmapi I know that I know nothing
WildByDesign Posted September 22 Posted September 22 I noticed an issue with the _WinAPI_IsDarkModeAllowedForWindow() function: Func _WinAPI_IsDarkModeAllowedForWindow() If @OSBuild < 17763 Then Return SetError(-1, 0, False) Local $fnIsDarkModeAllowedForWindow = 137 Local $aResult = DllCall('uxtheme.dll', 'bool', $fnIsDarkModeAllowedForWindow) If @error Or Not IsArray($aResult) Then Return SetError(@error, @extended, False) Return $aResult[0] EndFunc ;==>_WinAPI_IsDarkModeAllowedForWindow It is actually supposed to be called on a window handle, for example _WinAPI_IsDarkModeAllowedForWindow($hWnd) There is not a lot of information out there because it's undocumented and I am not good at understanding DllCall yet. In VB (https://www.vbforums.com/showthread.php?900444-Windows-10-Dark-Mode-amp-VB6-apps), they have it looking like this: Private Declare Function IsDarkModeAllowedForWindow Lib "uxtheme.dll" Alias "#137" (HWND As Long) As Boolean So far, I have tried: Func _WinAPI_IsDarkModeAllowedForWindow_mod($hWnd) If @OSBuild < 17763 Then Return SetError(-1, 0, False) Local $fnIsDarkModeAllowedForWindow = 137 Local $aResult = DllCall('uxtheme.dll', 'bool', $fnIsDarkModeAllowedForWindow, 'hwnd', $hWnd) If @error Or Not IsArray($aResult) Then Return SetError(@error, @extended, False) Return $aResult[0] EndFunc ;==>_WinAPI_IsDarkModeAllowedForWindow_mod But it's not working and I am only guessing at this point. If there is anybody who is good and understanding DllCall and knows how to fix this, can you please help? Thank you
WildByDesign Posted October 18 Posted October 18 @argumentum Out of curiosity, I edited your famous GUIDarkMode_v0.02mod.au3 UDF and did a quick search and replace to find all DarkMode_Explorer and replace with the new DarkMode_DarkTheme classes. I combined that with the original SampleControls GUI example that comes with AutoIt. Anyway, it is an entirely new theme and the controls look great. MS talks about dark mode Run dialog and a few things in their Insider blogs. They seem to be downplaying it because it is all new theming for Buttons, ListViews, etc. All new.
argumentum Posted October 18 Posted October 18 (edited) 11 minutes ago, WildByDesign said: Anyway, it is an entirely new theme and the controls look great. I'd have to look at it but "I ain't got time for that" Since you ( and UEZ ) are doing stuff to it, might as well ... add a $g_DarkModeType = 1, or 2, for the old/new style.. 🤷♂️ Good to know that M$ are attending to it Edited October 18 by argumentum Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
WildByDesign Posted October 18 Posted October 18 6 hours ago, argumentum said: Since you ( and UEZ ) are doing stuff to it, might as well ... add a $g_DarkModeType = 1, or 2, for the old/new style.. 🤷♂️ Good idea. I probably have to find out which build is going to have it for everyone and check based on OS build. Since MS is always doing that A/B testing these days for so many things, you never know if everyone else has the same features or not. 6 hours ago, argumentum said: Good to know that M$ are attending to it Yes, and I'm quite shocked at how thorough it is. Better late than never. There's even a beautiful dark mode status bar finally. So no more needing to jump through so many hoops to achieve it. I added 'msctls_statusbar32' to the UDF and it automatically does dark mode now for statusbar. I really enjoy how your UDF cycles through all of the controls and everything to make it easy to apply. There are still probably a dozen more controls that I need to check and see if MS added dark mode. But I am short on time right now as well, unfortunately. argumentum 1
NoNameCode Posted November 26 Author Posted November 26 On 5/20/2024 at 10:46 PM, jpm said: @argumentumI don't know how you can color the updown in black and also the left part of the Tab control a coloring of the date control can be a good improvement too. I implement a GUISetDarkTheme($hGui) which working the same , no need to use a callback I hope somebody can help. @jpm Up Down for Input is a "msctls_updown32" Class, it gets the Theme "Explorer" Hope that helps. Question: Are you planing to implement this Native to Autoit? Kind Regards NoNameCode
argumentum Posted November 26 Posted November 26 (edited) If M$ applied itself, we could have proper themes for dark mode. As is, I doubt that a proper implementation could be done in AutoIt3. Per-monitor scaling could be implemented internally in AutoIt3 but that is yet to be seen. Edited November 26 by argumentum English Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
Nine Posted November 27 Posted November 27 Today it is dark mode. Tomorrow it is going to be blueish mode. Next ??? argumentum 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
argumentum Posted November 27 Posted November 27 27 minutes ago, Nine said: Today... Oh no !, not "today". I've been bitching about it since 2019. You can see coders coding in a black background since the longest time. Why not the whole OS ?, ah !, why NoNameCode 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
NoNameCode Posted November 27 Author Posted November 27 2 hours ago, argumentum said: If M$ applied itself, we could have proper themes for dark mode. As is, I doubt that a proper implementation could be done in AutoIt3. Per-monitor scaling could be implemented internally in AutoIt3 but that is yet to be seen. @argumentum Damn looks Crazy, is this W32 or is this a different UDF?
argumentum Posted November 27 Posted November 27 Is a theme ( BIB3 by niivu ) and the best ( and I would say the only way ) to have a theme in windows. The user shouldn't have to choose each app in a color. The OS should have a homogeneous theme throughout. This "dark mode" per app is wrong, but is what M$ does ¯\_(ツ)_/¯ WildByDesign and NoNameCode 1 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
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