Jump to content

Recommended Posts

Posted
18 minutes ago, argumentum said:

Add #include "DLL_OpenClose.au3" as the 1st include on every script that uses them DLLs and, it'll be better.

This is a great idea, thank you. Since there will be several files (.Au3 files plus icons folder), should I make the UDF be a sub-folder to keep organized?

20 minutes ago, argumentum said:

/ HiDPI ) project

I just wanted to clarify, the UDF will only be about dark mode. The reason for using your high DPI controls UDF is simply to ensure that the Examples visually appear at their best experience. Your UDF is the best for resizing all controls mathematically to match the DPI for the window. :)

Posted
3 minutes ago, WildByDesign said:

I just wanted to clarify, the UDF will only be about dark mode.

Do you use scaling due to your Monitor ? If "no", the real answer is "not yet"
Looking at a HiDPI monitor is a mater of time. And seeing it in it own "max. resolution"

Spoiler

image.png.811c31ee8342175a9b46c259d24020d8.png

looks very nice.

So even if your project is for dark mode only, and the HiDPI is a "nice touch", the evolution of the HiDPI will be an inevitable thing that every year is more pressing.

Ok, back to topic.

12 minutes ago, WildByDesign said:

should I make the UDF be a sub-folder to keep organized?

hmm, I don't know. I don't think so. You're coding a UDF, not script per say. So no, the user can later add it to any folder the users wishes.
If the DLLs you open are just for your UDF then you should name the variables something like "$__g_MyUDF_hDLL_ThisOne", so that is not going to match some other common name, and you do you own DLL cleanup of the DLLs your UDF opens.

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted
5 hours ago, argumentum said:

Do you use scaling due to your Monitor ? If "no", the real answer is "not yet"
Looking at a HiDPI monitor is a mater of time. And seeing it in it own "max. resolution"

My main uses 125% scaling and I have another that uses 150%.

That screenshot of the help file looks sharp and amazing! By the way, the dark mode work that you are doing on that help file stuff is great. So much easier on the eyes.

Posted

I am thinking about Base64 encoding the icons from the /icons folder. Those are for the ListView/TreeView ImageLists.

Do Base64 encoded images allow for the transparency?

I assume that I would have to do one for each DPI size which is included in each .ico file.

Posted
45 minutes ago, WildByDesign said:

Do Base64 encoded images allow for the transparency?

Base64:
"Base64 encoding works by converting binary data (like images, files) into a text format using 64 printable ASCII characters, allowing it to be safely sent over text-based systems (email, HTTP). It groups input data into 24-bit blocks (three 8-bit bytes), splits these into four 6-bit chunks, and maps each 6-bit value to a character from its 64-character set (A-Z, a-z, 0-9, +, /), adding padding ( == or = ) for incomplete blocks. "

Image with transparency:
"While standard RGB images use three channels (red, green, and blue) to display color, images with transparency add this fourth alpha channel that controls opacity. Each pixel in the alpha channel contains a value that determines how transparent that pixel should be, from completely invisible to fully opaque."

Leaves in trees:
"Leaves serve multiple functions for a tree's ability to grow and thrive. The most well-known function of tree leaves is to facilitate the process of photosynthesis. This process occurs when the leaves use the energy from the sun to create fuel for the tree."

@argumentum in a forum:
"Fills entries called posts in a thread, not necessarily on topic."

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted (edited)

$GUI_CHECKED (1) = checked.ico = Radio, Checkbox, MenuItem or ListViewItem will be checked.
$GUI_INDETERMINATE (2) = ???????? = Checkbox having the tristate attribute will be greyed. 
$GUI_UNCHECKED (4) = unchecked.ico = Radio, Checkbox, MenuItem or ListViewItem will be unchecked. 

The indeterminate.ico is needed :)

...
    #Region CHECKBOX ; Global Const $BS_AUTO3STATE = 0x0006
    _HiDpi_GUICtrlCreateCheckbox("Checkbox", 130, 335, 80, 20, 0x0006)
    GUICtrlSetTip(-1, '#Region CHECKBOX')
;~  GUICtrlSetState(-1, $GUI_CHECKED)
    GUICtrlSetState(-1, $GUI_INDETERMINATE)
    #EndRegion CHECKBOX
...

 

Edited by argumentum

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted (edited)
41 minutes ago, argumentum said:

The indeterminate.ico is needed :)

This is a good point and something that I need to look into. Also I found a few other issues related to this. So thank you for bringing it to my attention.

I'm not sure if the indeterminate would work or not though. The ListView state imagelist only contains 2 image states while the TreeView imagelist only contains 3 image states. I could have it backwards, but one of them has 2 state images and the other has 3.

EDIT: It looks like I've got my TreeView ImageList completely backwards. 🤣

Edited by WildByDesign
Posted

There seems to be a bug in AutoIt where GUICtrlSetState does not work at all for ListViewItems even though the documentation states that it does.

GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlSetState(-1, $GUI_UNCHECKED)

Those work appropriately for TreeView items but not ListView items. I am testing it with ListViews created with GUICtrlCreateListView (extended style $LVS_EX_CHECKBOXES) and the items created with GUICtrlCreateListViewItem.

Posted (edited)

...not sure this chunk of GDI+ serves the intermediate need, but here it goes:
image.png.8023100ca173d8327090f70dac0e0b34.png       image.png.19649c6053426c6bae65972426d6be68.png

Spoiler
#include <GUIConstantsEx.au3>
#include <TreeViewConstants.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <GDIPlus.au3>
#include <WinAPIGdi.au3>


#include "GuiCtrls_HiDpi.au3"
; initiate System DPI awareness and control scaling
_HiDpi_Ctrl_LazyInit()



; ..thanks to google gemini AI is that I can offer this idea
; ==============================================================================
; USER CONFIGURATION - SELECT YOUR STYLE HERE
; ==============================================================================
Global $CLR_TREE_BG    = 0x181818 ; Main Tree Background
Global $CLR_TREE_TEXT  = 0xD0D0D0 ; Main Text Color
Global $CLR_CHECK_OFF  = 0xFF353535 ; Unchecked box color (ARGB)
Global $CLR_CHECK_ON   = 0xFF60CDFF ; Checked/Indeterminate box color (ARGB)
Global $CLR_GLYPH      = 0xFF000000 ; Color for the Check/Dash (ARGB)

; --- USER DECIDES THICKNESS HERE ---
Global $g_iWEIGHT       = 1.2      ; Base thickness (e.g., 1.5, 2.0, 3.0)
Global $g_iBaseIconSize = 18
; ==============================================================================

_GDIPlus_Startup()

; 1. DPI and Scaling Setup
Local $hDC = _WinAPI_GetDC(0)
Global $fScale = _WinAPI_GetDeviceCaps($hDC, 90) / 96
_WinAPI_ReleaseDC(0, $hDC)
Local $iSize = Int($g_iBaseIconSize * $fScale) ; Base icon size

$hGUI = _HiDpi_GUICreate("Custom Weight Dark Tree", 450, 450)
GUISetBkColor($CLR_TREE_BG)

$idTreeView = _HiDpi_GUICtrlCreateTreeView(10, 10, 430, 430, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT))
GUICtrlSetBkColor(-1, $CLR_TREE_BG)
GUICtrlSetColor(-1, $CLR_TREE_TEXT)
Global $hTreeView = GUICtrlGetHandle($idTreeView)

; 2. Create Scaled State ImageList
Global $hImageList = _GUIImageList_Create($iSize, $iSize, 5, 3)
_UpdateImageList($iSize)
_GUICtrlTreeView_SetStateImageList($hTreeView, $hImageList)

; 3. Build Tree
$hRoot = _GUICtrlTreeView_Add($hTreeView, 0, "System Root")
$hChild1 = _GUICtrlTreeView_AddChild($hTreeView, $hRoot, "Hardware Config")
    _GUICtrlTreeView_AddChild($hTreeView, $hChild1, "Processor")
    _GUICtrlTreeView_AddChild($hTreeView, $hChild1, "Memory")
$hChild2 = _GUICtrlTreeView_AddChild($hTreeView, $hRoot, "Resources")
    _GUICtrlTreeView_AddChild($hTreeView, $hChild2, "This")
    _GUICtrlTreeView_AddChild($hTreeView, $hChild2, "That")

_SetAllStates($hRoot, 1)

_GUICtrlTreeView_Expand($hTreeView)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
GUISetState()

While 1
    If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

_GDIPlus_Shutdown()
GUIDelete()

; --- GDI+ Drawing Function ---

Func _CreateCheckboxBitmap($iS, $iType)
    Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iS, $iS)
    Local $hGfx = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hGfx, 4)

    Local $iPad = $iS * 0.05, $iBoxS = $iS - ($iPad * 2), $fRad = $iBoxS * 0.2

    ; Create Rounded Path
    Local $hPath = _GDIPlus_PathCreate()
    _GDIPlus_PathAddArc($hPath, $iPad, $iPad, $fRad*2, $fRad*2, 180, 90)
    _GDIPlus_PathAddArc($hPath, $iPad+$iBoxS-$fRad*2, $iPad, $fRad*2, $fRad*2, 270, 90)
    _GDIPlus_PathAddArc($hPath, $iPad+$iBoxS-$fRad*2, $iPad+$iBoxS-$fRad*2, $fRad*2, $fRad*2, 0, 90)
    _GDIPlus_PathAddArc($hPath, $iPad, $iPad+$iBoxS-$fRad*2, $fRad*2, $fRad*2, 90, 90)
    _GDIPlus_PathCloseFigure($hPath)

    ; Fill Color
    Local $iColor = ($iType = 0) ? $CLR_CHECK_OFF : $CLR_CHECK_ON
    Local $hBrush = _GDIPlus_BrushCreateSolid($iColor)
    _GDIPlus_GraphicsFillPath($hGfx, $hPath, $hBrush)

    ; --- DYNAMIC WEIGHT CALCULATION ---
    Local $hPen = _GDIPlus_PenCreate($CLR_GLYPH, $fScale * $g_iWEIGHT)
    _GDIPlus_PenSetStartCap($hPen, 2) ; Rounded line ends
    _GDIPlus_PenSetEndCap($hPen, 2)

    If $iType = 1 Then ; CHECKED
        _GDIPlus_GraphicsDrawLine($hGfx, $iS*0.30, $iS*0.50, $iS*0.48, $iS*0.70, $hPen)
        _GDIPlus_GraphicsDrawLine($hGfx, $iS*0.48, $iS*0.70, $iS*0.75, $iS*0.35, $hPen)
    ElseIf $iType = 2 Then ; INDETERMINATE (0x0006)
        _GDIPlus_GraphicsDrawLine($hGfx, $iS*0.28, $iS*0.5, $iS*0.72, $iS*0.5, $hPen)
    EndIf

    ; Cleanup
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_PathDispose($hPath)
    _GDIPlus_GraphicsDispose($hGfx)
    Local $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
    _GDIPlus_BitmapDispose($hBitmap)
    Return $hHBitmap
EndFunc

; --- Helper Functions (Updated) ---

Func _UpdateImageList($iS)
    _GUIImageList_Add($hImageList, _CreateCheckboxBitmap($iS, 0))
    _GUIImageList_Add($hImageList, _CreateCheckboxBitmap($iS, 1))
    _GUIImageList_Add($hImageList, _CreateCheckboxBitmap($iS, 2))
EndFunc

Func _SetAllStates($hItem, $iState)
    _GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem, $iState)
    Local $hChild = _GUICtrlTreeView_GetFirstChild($hTreeView, $hItem)
    While $hChild <> 0
        _SetAllStates($hChild, $iState)
        $hChild = _GUICtrlTreeView_GetNextSibling($hTreeView, $hChild)
    WEnd
EndFunc

Func _UpdateParentState($hItem)
    Local $hParent = _GUICtrlTreeView_GetParentHandle($hTreeView, $hItem)
    If $hParent = 0 Then Return
    Local $iChecked = 0, $iUnchecked = 0, $iTotal = 0
    Local $hChild = _GUICtrlTreeView_GetFirstChild($hTreeView, $hParent)
    While $hChild <> 0
        $iTotal += 1
        Local $iS = _GUICtrlTreeView_GetStateImageIndex($hTreeView, $hChild)
        If $iS = 2 Then $iChecked += 1
        If $iS = 1 Then $iUnchecked += 1
        $hChild = _GUICtrlTreeView_GetNextSibling($hTreeView, $hChild)
    WEnd
    Local $iFinal = ($iChecked = $iTotal) ? 2 : (($iUnchecked = $iTotal) ? 1 : 3)
    _GUICtrlTreeView_SetStateImageIndex($hTreeView, $hParent, $iFinal)
    _UpdateParentState($hParent)
EndFunc

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    If DllStructGetData($tNMHDR, "hWndFrom") = $hTreeView Then
        Switch DllStructGetData($tNMHDR, "Code")
            Case $NM_CLICK
                Local $tPoint = _WinAPI_GetMousePos(True, $hTreeView)
                Local $tHit = _GUICtrlTreeView_HitTestEx($hTreeView, DllStructGetData($tPoint, 1), DllStructGetData($tPoint, 2))
                If BitAND(DllStructGetData($tHit, "Flags"), $TVHT_ONITEMSTATEICON) Then _ToggleItem(DllStructGetData($tHit, "Item"))
            Case $TVN_KEYDOWN
                Local $tNKD = DllStructCreate("struct;hwnd hWndFrom;uint_ptr IDFrom;uint Code;endstruct;word VKey;uint Flags", $ilParam)
                If DllStructGetData($tNKD, "VKey") = 0x20 Then
                    _ToggleItem(_GUICtrlTreeView_GetSelection($hTreeView))
                    Return 1
                EndIf
        EndSwitch
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc

Func _ToggleItem($hItem)
    If $hItem = 0 Then Return
    Local $iNewState = (_GUICtrlTreeView_GetStateImageIndex($hTreeView, $hItem) = 2) ? 1 : 2
    _GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem, $iNewState)
    _SetAllStates($hItem, $iNewState)
    _UpdateParentState($hItem)
EndFunc

..this code looks ugly but is just the idea

..so, maybe we don't need to have external resources 🤔

Edited by argumentum

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted (edited)
10 minutes ago, argumentum said:

..so, maybe we don't need to have external resources 🤔

Wow! That looks fantastic and works well too. Ideally I would like to get rid of those external icons, for sure.

So we could draw them, as you suggest. And look awesome, by the way.

While you were coding that, I also thought of another idea. The Fluent fonts that come with Win11 have them included. If we were to use the font method, we would simply have to alter the color and that is about it. Just another option anyway. The MDL2 font on Win10 has it as well but less rounded.

fluent.png

Edited by WildByDesign
Posted

@argumentum I keep updating your custom GDI+ example as you update it bit by bit. Without a doubt, that is the sharpest, nicest TreeView I have ever seen. Follows the sharpness with each DPI setting. I can't stop looking at it! 😃

Seriously, I am still checking and unchecking...

On a side note, it does not seem to behave appropriately with TreeViews that already have the $TVS_CHECKBOXES style. I'm trying to figure that out at the moment.

Posted (edited)
3 hours ago, WildByDesign said:

I am thinking about Base64 encoding the icons from the /icons folder. Those are for the ListView/TreeView ImageLists.

Do Base64 encoded images allow for the transparency?

I assume that I would have to do one for each DPI size which is included in each .ico file.

GUIDarkTheme.au3 incl. base64 icons:

#include-once
#AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
#include <GDIPlus.au3>

; #INDEX# =======================================================================================================================
; Title .........: GUIDarkTheme UDF Library for AutoIt3
; AutoIt Version : 3.3.18.0
; Language ......: English
; Description ...: UDF library for applying dark theme to win32 controls
; Author(s) .....: WildByDesign (including previous code from NoNameCode, argumentum, UEZ)
; Version .......: 0.9
; ===============================================================================================================================

; Windows messages used by GUIDarkTheme: (only when relevant controls are detected)
; $WM_CTLCOLORLISTBOX
; $WM_CTLCOLOREDIT
; $WM_NOTIFY

; Windows messages used by GUIDarkMenu: (activated only if GUI has a menubar)
; $WM_DRAWITEM
; $WM_MEASUREITEM
; $WM_NCPAINT
; $WM_ACTIVATE

#Region Functions list
; #CURRENT# =====================================================================================================================
; _GUISetDarkTheme
; _GUICtrlSetDarkTheme
; _GUICtrlAllSetDarkTheme
; _ApplyDarkTheme
; _ApplyLightTheme
; ===============================================================================================================================
#EndRegion Functions list

#Region API Functions list
; #CURRENT# =====================================================================================================================
; _WinAPI_ShouldAppsUseDarkMode
; _WinAPI_AllowDarkModeForWindow
; _WinAPI_AllowDarkModeForApp
; _WinAPI_FlushMenuThemes
; _WinAPI_RefreshImmersiveColorPolicyState
; _WinAPI_IsDarkModeAllowedForWindow
; _WinAPI_GetIsImmersiveColorUsingHighContrast
; _WinAPI_OpenNcThemeData
; ===============================================================================================================================
#EndRegion API Functions list

#include <GuiMonthCal.au3>
#include <GuiDateTimePicker.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <TabConstants.au3>
#include <GuiImageList.au3>
#include <GuiTreeView.au3>
#include <GuiMenu.au3>

#include "GUIDarkInternal.au3"
#include "GUIDarkMenu.au3"

#Region Global Variables and Constants

; #VARIABLES# ===================================================================================================================

; Windows build information
Global $iOSBuild = @OSBuild
Global $iRevision = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "UBR")
Global $b24H2Plus = False

If $iOSBuild >= 26100 And $iRevision >= 6899 Then $b24H2Plus = True

; Fake lower build number to test DarkMode_Explorer
;$b24H2Plus = False

; Declare edit brush
Global $g_hBrushEdit = 0

; Global variable for tab subclassing
Global $g_hTab_CB, $g_pTab_CB, $g_hProc, $g_hTab

; Set global variable placeholders in the case SysListView32 control is detected
; TODO: need better method if there are multiple ListView controls
Global $hWndListViewHeader, $hWndListView
Global $g__ListView_wProcNew = 0, $g__ListView_wProcOld = 0

; DateTimePicker
Global $g_hDateProc_CB, $g_pDateProc_CB, $g_hDateOldProc, $g_hDate
Global Const $PRF_CLIENT = 0x0004, $DTP_BORDER = 0x404040, $DTP_BG_DARK = $COLOR_CONTROL_BG, $DTP_TEXT_LIGHT = $COLOR_TEXT_LIGHT, $DTP_BORDER_LIGHT = 0xD8D8D8
Global $g_bHover = False

; Structure for NM_CUSTOMDRAW notification
Global Const $tagNMCUSTOMDRAW = _
            $tagNMHDR & ";" & _                                ; Contains NM_CUSTOMDRAW / NMHDR header among other things
            "dword dwDrawStage;" & _                           ; Current drawing stage (CDDS_*)
            "handle hdc;" & _                                  ; Device Context Handle
            "long left;long top;long right;long bottom;" & _   ; Drawing rectangle
            "dword_ptr dwItemSpec;" & _                        ; Item index or other info (depending on the control)
            "uint uItemState;" & _                             ; State Flags (CDIS_SELECTED, CDIS_FOCUS etc.)
            "lparam lItemlParam"                               ; lParam set by the item (e.g., via LVITEM.lParam)

#Region ; GUIStyles.inc.au3
;~ #include "GUIStyles.inc.au3"

Global Const $_g__Style_Gui[32][2] = _
   [[0x80000000, 'WS_POPUP'], _
    [0x40000000, 'WS_CHILD'], _
    [0x20000000, 'WS_MINIMIZE'], _
    [0x10000000, 'WS_VISIBLE'], _
    [0x08000000, 'WS_DISABLED'], _
    [0x04000000, 'WS_CLIPSIBLINGS'], _
    [0x02000000, 'WS_CLIPCHILDREN'], _
    [0x01000000, 'WS_MAXIMIZE'], _
    [0x00CF0000, 'WS_OVERLAPPEDWINDOW'], _ ; (WS_CAPTION | WS_SYSMENU | WS_SIZEBOX | WS_MINIMIZEBOX | WS_MAXIMIZEBOX) aka 'WS_TILEDWINDOW'
    [0x00C00000, 'WS_CAPTION'], _          ; (WS_BORDER | WS_DLGFRAME)
    [0x00800000, 'WS_BORDER'], _
    [0x00400000, 'WS_DLGFRAME'], _
    [0x00200000, 'WS_VSCROLL'], _
    [0x00100000, 'WS_HSCROLL'], _
    [0x00080000, 'WS_SYSMENU'], _
    [0x00040000, 'WS_SIZEBOX'], _
    [0x00020000, '! WS_MINIMIZEBOX ! WS_GROUP'], _   ; ! GUI ! Control
    [0x00010000, '! WS_MAXIMIZEBOX ! WS_TABSTOP'], _ ; ! GUI ! Control
    [0x00002000, 'DS_CONTEXTHELP'], _
    [0x00001000, 'DS_CENTERMOUSE'], _
    [0x00000800, 'DS_CENTER'], _
    [0x00000400, 'DS_CONTROL'], _
    [0x00000200, 'DS_SETFOREGROUND'], _
    [0x00000100, 'DS_NOIDLEMSG'], _
    [0x00000080, 'DS_MODALFRAME'], _
    [0x00000040, 'DS_SETFONT'], _
    [0x00000020, 'DS_LOCALEDIT'], _
    [0x00000010, 'DS_NOFAILCREATE'], _
    [0x00000008, 'DS_FIXEDSYS'], _
    [0x00000004, 'DS_3DLOOK'], _
    [0x00000002, 'DS_SYSMODAL'], _
    [0x00000001, 'DS_ABSALIGN']]
    ;
    ; [0x80880000, 'WS_POPUPWINDOW']
    ; [0x20000000, 'WS_ICONIC']
    ; [0x00040000, 'WS_THICKFRAME']
    ;
    ; [0x00000000, 'WS_OVERLAPPED'] ; also named 'WS_TILED'


Global Const $_g__Style_GuiExtended[21][2] = _
   [[0x08000000, 'WS_EX_NOACTIVATE'], _
    [0x02000000, 'WS_EX_COMPOSITED'], _
    [0x00400000, 'WS_EX_LAYOUTRTL'], _
    [0x00100000, '! WS_EX_NOINHERITLAYOUT ! GUI_WS_EX_PARENTDRAG'], _ ; ! GUI ! Control (label or pic, AutoIt "draggable" feature on 2 controls)
    [0x00080000, 'WS_EX_LAYERED'], _
    [0x00040000, 'WS_EX_APPWINDOW'], _
    [0x00020000, 'WS_EX_STATICEDGE'], _
    [0x00010000, 'WS_EX_CONTROLPARENT'], _ ; AutoIt adds a "draggable" feature to this GUI extended style behavior
    [0x00004000, 'WS_EX_LEFTSCROLLBAR'], _
    [0x00002000, 'WS_EX_RTLREADING'], _
    [0x00001000, 'WS_EX_RIGHT'], _
    [0x00000400, 'WS_EX_CONTEXTHELP'], _
    [0x00000200, 'WS_EX_CLIENTEDGE'], _
    [0x00000100, 'WS_EX_WINDOWEDGE'], _
    [0x00000080, 'WS_EX_TOOLWINDOW'], _
    [0x00000040, 'WS_EX_MDICHILD'], _
    [0x00000020, 'WS_EX_TRANSPARENT'], _
    [0x00000010, 'WS_EX_ACCEPTFILES'], _
    [0x00000008, 'WS_EX_TOPMOST'], _
    [0x00000004, 'WS_EX_NOPARENTNOTIFY'], _
    [0x00000001, 'WS_EX_DLGMODALFRAME']]
    ;
    ; [0x00000300, 'WS_EX_OVERLAPPEDWINDOW']
    ; [0x00000188, 'WS_EX_PALETTEWINDOW']
    ;
    ; [0x00000000, 'WS_EX_LEFT']
    ; [0x00000000, 'WS_EX_LTRREADING']
    ; [0x00000000, 'WS_EX_RIGHTSCROLLBAR']


Global Const $_g__Style_Avi[5][2] = _
   [[0x0010, 'ACS_NONTRANSPARENT'], _
    [0x0008, 'ACS_TIMER'], _
    [0x0004, 'ACS_AUTOPLAY'], _
    [0x0002, 'ACS_TRANSPARENT'], _
    [0x0001, 'ACS_CENTER']]


Global Const $_g__Style_Button[20][2] = _
   [[0x8000, 'BS_FLAT'], _
    [0x4000, 'BS_NOTIFY'], _
    [0x2000, 'BS_MULTILINE'], _
    [0x1000, 'BS_PUSHLIKE'], _
    [0x0C00, 'BS_VCENTER'], _
    [0x0800, 'BS_BOTTOM'], _
    [0x0400, 'BS_TOP'], _
    [0x0300, 'BS_CENTER'], _
    [0x0200, 'BS_RIGHT'], _
    [0x0100, 'BS_LEFT'], _
    [0x0080, 'BS_BITMAP'], _
    [0x0040, 'BS_ICON'], _
    [0x0020, 'BS_RIGHTBUTTON'], _
    [0x0009, 'BS_AUTORADIOBUTTON'] , _
    [0x0007, 'BS_GROUPBOX'], _
    [0x0006, 'BS_AUTO3STATE'], _
    [0x0005, 'BS_3STATE'], _
    [0x0003, 'BS_AUTOCHECKBOX'], _
    [0x0002, 'BS_CHECKBOX'], _
    [0x0001, 'BS_DEFPUSHBUTTON']]


Global Const $_g__Style_Combo[13][2] = _
   [[0x4000, 'CBS_LOWERCASE'], _
    [0x2000, 'CBS_UPPERCASE'], _
    [0x0800, 'CBS_DISABLENOSCROLL'], _
    [0x0400, 'CBS_NOINTEGRALHEIGHT'], _
    [0x0200, 'CBS_HASSTRINGS'], _
    [0x0100, 'CBS_SORT'], _
    [0x0080, 'CBS_OEMCONVERT'], _
    [0x0040, 'CBS_AUTOHSCROLL'], _
    [0x0020, 'CBS_OWNERDRAWVARIABLE'], _
    [0x0010, 'CBS_OWNERDRAWFIXED'], _
    [0x0003, 'CBS_DROPDOWNLIST'], _
    [0x0002, 'CBS_DROPDOWN'], _
    [0x0001, 'CBS_SIMPLE']]


Global Const $_g__Style_Common[12][2] = _ ; "for rebar controls, toolbar controls, and status windows (msdn)"
   [[0x0083, 'CCS_RIGHT'], _
    [0x0082, 'CCS_NOMOVEX'], _
    [0x0081, 'CCS_LEFT'], _
    [0x0080, 'CCS_VERT'], _
    [0x0040, 'CCS_NODIVIDER'], _
    [0x0020, 'CCS_ADJUSTABLE'], _
    [0x0010, 'CCS_NOHILITE'], _
    [0x0008, 'CCS_NOPARENTALIGN'], _
    [0x0004, 'CCS_NORESIZE'], _
    [0x0003, 'CCS_BOTTOM'], _
    [0x0002, 'CCS_NOMOVEY'], _
    [0x0001, 'CCS_TOP']]


Global Const $_g__Style_DateTime[7][2] = _
   [[0x0020, 'DTS_RIGHTALIGN'], _
    [0x0010, 'DTS_APPCANPARSE'], _
    [0x000C, 'DTS_SHORTDATECENTURYFORMAT'], _
    [0x0009, 'DTS_TIMEFORMAT'], _
    [0x0004, 'DTS_LONGDATEFORMAT'], _
    [0x0002, 'DTS_SHOWNONE'], _
    [0x0001, 'DTS_UPDOWN']]
    ;
    ; [0x0000, 'DTS_SHORTDATEFORMAT']


Global Const $_g__Style_Edit[13][2] = _
   [[0x2000, 'ES_NUMBER'], _
    [0x1000, 'ES_WANTRETURN'], _
    [0x0800, 'ES_READONLY'], _
    [0x0400, 'ES_OEMCONVERT'], _
    [0x0100, 'ES_NOHIDESEL'], _
    [0x0080, 'ES_AUTOHSCROLL'], _
    [0x0040, 'ES_AUTOVSCROLL'], _
    [0x0020, 'ES_PASSWORD'], _
    [0x0010, 'ES_LOWERCASE'], _
    [0x0008, 'ES_UPPERCASE'], _
    [0x0004, 'ES_MULTILINE'], _
    [0x0002, 'ES_RIGHT'], _
    [0x0001, 'ES_CENTER']]


Global Const $_g__Style_Header[10][2] = _
   [[0x1000, 'HDS_OVERFLOW'], _
    [0x0800, 'HDS_NOSIZING'], _
    [0x0400, 'HDS_CHECKBOXES'], _
    [0x0200, 'HDS_FLAT'], _
    [0x0100, 'HDS_FILTERBAR'], _
    [0x0080, 'HDS_FULLDRAG'], _
    [0x0040, 'HDS_DRAGDROP'], _
    [0x0008, 'HDS_HIDDEN'], _
    [0x0004, 'HDS_HOTTRACK'], _
    [0x0002, 'HDS_BUTTONS']]
    ;
    ; [0x0000, '$HDS_HORZ']


Global Const $_g__Style_ListBox[16][2] = _
   [[0x8000, 'LBS_COMBOBOX'], _
    [0x4000, 'LBS_NOSEL'], _
    [0x2000, 'LBS_NODATA'], _
    [0x1000, 'LBS_DISABLENOSCROLL'], _
    [0x0800, 'LBS_EXTENDEDSEL'], _
    [0x0400, 'LBS_WANTKEYBOARDINPUT'], _
    [0x0200, 'LBS_MULTICOLUMN'], _
    [0x0100, 'LBS_NOINTEGRALHEIGHT'], _
    [0x0080, 'LBS_USETABSTOPS'], _
    [0x0040, 'LBS_HASSTRINGS'], _
    [0x0020, 'LBS_OWNERDRAWVARIABLE'], _
    [0x0010, 'LBS_OWNERDRAWFIXED'], _
    [0x0008, 'LBS_MULTIPLESEL'], _
    [0x0004, 'LBS_NOREDRAW'], _
    [0x0002, 'LBS_SORT'], _
    [0x0001, 'LBS_NOTIFY']]
    ;
    ; [0xA00003, 'LBS_STANDARD'] ; i.e. (LBS_NOTIFY | LBS_SORT | WS_VSCROLL | WS_BORDER) help file correct, ListBoxConstants.au3 incorrect


Global Const $_g__Style_ListView[17][2] = _
   [[0x8000, 'LVS_NOSORTHEADER'], _
    [0x4000, 'LVS_NOCOLUMNHEADER'], _
    [0x2000, 'LVS_NOSCROLL'], _
    [0x1000, 'LVS_OWNERDATA'], _
    [0x0800, 'LVS_ALIGNLEFT'], _
    [0x0400, 'LVS_OWNERDRAWFIXED'], _
    [0x0200, 'LVS_EDITLABELS'], _
    [0x0100, 'LVS_AUTOARRANGE'], _
    [0x0080, 'LVS_NOLABELWRAP'], _
    [0x0040, 'LVS_SHAREIMAGELISTS'], _
    [0x0020, 'LVS_SORTDESCENDING'], _
    [0x0010, 'LVS_SORTASCENDING'], _
    [0x0008, 'LVS_SHOWSELALWAYS'], _
    [0x0004, 'LVS_SINGLESEL'], _
    [0x0003, 'LVS_LIST'], _
    [0x0002, 'LVS_SMALLICON'], _
    [0x0001, 'LVS_REPORT']]
    ;
    ; [0x0000, 'LVS_ICON']
    ; [0x0000, 'LVS_ALIGNTOP']


Global Const $_g__Style_ListViewExtended[20][2] = _
   [[0x00100000, 'LVS_EX_SIMPLESELECT'], _
    [0x00080000, 'LVS_EX_SNAPTOGRID'], _
    [0x00020000, 'LVS_EX_HIDELABELS'], _
    [0x00010000, 'LVS_EX_DOUBLEBUFFER'], _
    [0x00008000, 'LVS_EX_BORDERSELECT'], _
    [0x00004000, 'LVS_EX_LABELTIP'], _
    [0x00002000, 'LVS_EX_MULTIWORKAREAS'], _
    [0x00001000, 'LVS_EX_UNDERLINECOLD'], _
    [0x00000800, 'LVS_EX_UNDERLINEHOT'], _
    [0x00000400, 'LVS_EX_INFOTIP'], _
    [0x00000200, 'LVS_EX_REGIONAL'], _
    [0x00000100, 'LVS_EX_FLATSB'], _
    [0x00000080, 'LVS_EX_TWOCLICKACTIVATE'], _
    [0x00000040, 'LVS_EX_ONECLICKACTIVATE'], _
    [0x00000020, 'LVS_EX_FULLROWSELECT'], _
    [0x00000010, 'LVS_EX_HEADERDRAGDROP'], _
    [0x00000008, 'LVS_EX_TRACKSELECT'], _
    [0x00000004, 'LVS_EX_CHECKBOXES'], _
    [0x00000002, 'LVS_EX_SUBITEMIMAGES'], _
    [0x00000001, 'LVS_EX_GRIDLINES']]


Global Const $_g__Style_MonthCal[8][2] = _
   [[0x0100, 'MCS_NOSELCHANGEONNAV'], _
    [0x0080, 'MCS_SHORTDAYSOFWEEK'], _
    [0x0040, 'MCS_NOTRAILINGDATES'], _
    [0x0010, 'MCS_NOTODAY'], _
    [0x0008, 'MCS_NOTODAYCIRCLE'], _
    [0x0004, 'MCS_WEEKNUMBERS'], _
    [0x0002, 'MCS_MULTISELECT'], _
    [0x0001, 'MCS_DAYSTATE']]


Global Const $_g__Style_Pager[3][2] = _
   [[0x0004, 'PGS_DRAGNDROP'], _
    [0x0002, 'PGS_AUTOSCROLL'], _
    [0x0001, 'PGS_HORZ']]
    ;
    ; [0x0000, 'PGS_VERT']


Global Const $_g__Style_Progress[4][2] = _
   [[0x0010, 'PBS_SMOOTHREVERSE'], _
    [0x0008, 'PBS_MARQUEE'], _
    [0x0004, 'PBS_VERTICAL'], _
    [0x0001, 'PBS_SMOOTH']]


Global Const $_g__Style_Rebar[8][2] = _
   [[0x8000, 'RBS_DBLCLKTOGGLE'], _
    [0x4000, 'RBS_VERTICALGRIPPER'], _
    [0x2000, 'RBS_AUTOSIZE'], _
    [0x1000, 'RBS_REGISTERDROP'], _
    [0x0800, 'RBS_FIXEDORDER'], _
    [0x0400, 'RBS_BANDBORDERS'], _
    [0x0200, 'RBS_VARHEIGHT'], _
    [0x0100, 'RBS_TOOLTIPS']]


Global Const $_g__Style_RichEdit[8][2] = _      ; will also use plenty (not all) of Edit styles
   [[0x01000000, 'ES_SELECTIONBAR'], _
    [0x00400000, 'ES_VERTICAL'], _          ; Asian-language support only (msdn)
    [0x00080000, 'ES_NOIME'], _             ; ditto
    [0x00040000, 'ES_SELFIME'], _           ; ditto
    [0x00008000, 'ES_SAVESEL'], _
    [0x00004000, 'ES_SUNKEN'], _
    [0x00002000, 'ES_DISABLENOSCROLL'], _   ; same value as 'ES_NUMBER' => issue ?
    [0x00000008, 'ES_NOOLEDRAGDROP']]       ; same value as 'ES_UPPERCASE' but RichRdit controls do not support 'ES_UPPERCASE' style (msdn)


Global Const $_g__Style_Scrollbar[5][2] = _
   [[0x0010, 'SBS_SIZEGRIP'], _
    [0x0008, 'SBS_SIZEBOX'], _
    [0x0004, 'SBS_RIGHTALIGN or SBS_BOTTOMALIGN'], _ ; i.e. use SBS_RIGHTALIGN with SBS_VERT, use SBS_BOTTOMALIGN with SBS_HORZ (msdn)
    [0x0002, 'SBS_LEFTALIGN or SBS_TOPALIGN'], _     ; i.e. use SBS_LEFTALIGN  with SBS_VERT, use SBS_TOPALIGN    with SBS_HORZ (msdn)
    [0x0001, 'SBS_VERT']]
    ;
    ; [0x0000, 'SBS_HORZ']


Global Const $_g__Style_Slider[13][2] = _ ; i.e. trackbar
   [[0x1000, 'TBS_TRANSPARENTBKGND'], _
    [0x0800, 'TBS_NOTIFYBEFOREMOVE'], _
    [0x0400, 'TBS_DOWNISLEFT'], _
    [0x0200, 'TBS_REVERSED'], _
    [0x0100, 'TBS_TOOLTIPS'], _
    [0x0080, 'TBS_NOTHUMB'], _
    [0x0040, 'TBS_FIXEDLENGTH'], _
    [0x0020, 'TBS_ENABLESELRANGE'], _
    [0x0010, 'TBS_NOTICKS'], _
    [0x0008, 'TBS_BOTH'], _
    [0x0004, 'TBS_LEFT or TBS_TOP'], _ ; i.e. TBS_LEFT tick marks when vertical slider, or TBS_TOP tick marks when horizontal slider
    [0x0002, 'TBS_VERT'], _
    [0x0001, 'TBS_AUTOTICKS']]
    ;
    ; [0x0000, 'TBS_RIGHT']
    ; [0x0000, 'TBS_BOTTOM']
    ; [0x0000, 'TBS_HORZ']


Global Const $_g__Style_Static[18][2] = _
   [[0x1000, 'SS_SUNKEN'], _
    [0x0400, 'SS_RIGHTJUST'], _
    [0x0200, 'SS_CENTERIMAGE'], _
    [0x0100, 'SS_NOTIFY'], _
    [0x0080, 'SS_NOPREFIX'], _
    [0x0012, 'SS_ETCHEDFRAME'], _
    [0x0011, 'SS_ETCHEDVERT'], _
    [0x0010, 'SS_ETCHEDHORZ'], _
    [0x000C, 'SS_LEFTNOWORDWRAP'], _
    [0x000B, 'SS_SIMPLE'], _
    [0x0009, 'SS_WHITEFRAME'], _
    [0x0008, 'SS_GRAYFRAME'], _
    [0x0007, 'SS_BLACKFRAME'], _
    [0x0006, 'SS_WHITERECT'], _
    [0x0005, 'SS_GRAYRECT'], _
    [0x0004, 'SS_BLACKRECT'], _
    [0x0002, 'SS_RIGHT'], _
    [0x0001, 'SS_CENTER']]
    ;
    ; [0x0000, 'SS_LEFT']


Global Const $_g__Style_StatusBar[2][2] = _
   [[0x0800, 'SBARS_TOOLTIPS'], _
    [0x0100, 'SBARS_SIZEGRIP']]
    ;
    ; [0x0800, 'SBT_TOOLTIPS']


Global Const $_g__Style_Tab[17][2] = _
   [[0x8000, 'TCS_FOCUSNEVER'], _
    [0x4000, 'TCS_TOOLTIPS'], _
    [0x2000, 'TCS_OWNERDRAWFIXED'], _
    [0x1000, 'TCS_FOCUSONBUTTONDOWN'], _
    [0x0800, 'TCS_RAGGEDRIGHT'], _
    [0x0400, 'TCS_FIXEDWIDTH'], _
    [0x0200, 'TCS_MULTILINE'], _
    [0x0100, 'TCS_BUTTONS'], _
    [0x0080, 'TCS_VERTICAL'], _
    [0x0040, 'TCS_HOTTRACK'], _
    [0x0020, 'TCS_FORCELABELLEFT'], _
    [0x0010, 'TCS_FORCEICONLEFT'], _
    [0x0008, 'TCS_FLATBUTTONS'], _
    [0x0004, 'TCS_MULTISELECT'], _
    [0x0002, 'TCS_RIGHT'], _
    [0x0002, 'TCS_BOTTOM'], _
    [0x0001, 'TCS_SCROLLOPPOSITE']]
    ;
    ; [0x0000, 'TCS_TABS']
    ; [0x0000, 'TCS_SINGLELINE']
    ; [0x0000, 'TCS_RIGHTJUSTIFY']


Global Const $_g__Style_Toolbar[8][2] = _
   [[0x8000, 'TBSTYLE_TRANSPARENT'], _
    [0x4000, 'TBSTYLE_REGISTERDROP'], _
    [0x2000, 'TBSTYLE_CUSTOMERASE'], _
    [0x1000, 'TBSTYLE_LIST'], _
    [0x0800, 'TBSTYLE_FLAT'], _
    [0x0400, 'TBSTYLE_ALTDRAG'], _
    [0x0200, 'TBSTYLE_WRAPABLE'], _
    [0x0100, 'TBSTYLE_TOOLTIPS']]


Global Const $_g__Style_TreeView[16][2] = _
   [[0x8000, 'TVS_NOHSCROLL'], _
    [0x4000, 'TVS_NONEVENHEIGHT'], _
    [0x2000, 'TVS_NOSCROLL'], _
    [0x1000, 'TVS_FULLROWSELECT'], _
    [0x0800, 'TVS_INFOTIP'], _
    [0x0400, 'TVS_SINGLEEXPAND'], _
    [0x0200, 'TVS_TRACKSELECT'], _
    [0x0100, 'TVS_CHECKBOXES'], _
    [0x0080, 'TVS_NOTOOLTIPS'], _
    [0x0040, 'TVS_RTLREADING'], _
    [0x0020, 'TVS_SHOWSELALWAYS'], _
    [0x0010, 'TVS_DISABLEDRAGDROP'], _
    [0x0008, 'TVS_EDITLABELS'], _
    [0x0004, 'TVS_LINESATROOT'], _
    [0x0002, 'TVS_HASLINES'], _
    [0x0001, 'TVS_HASBUTTONS']]


Global Const $_g__Style_UpDown[9][2] = _
   [[0x0100, 'UDS_HOTTRACK'], _
    [0x0080, 'UDS_NOTHOUSANDS'], _
    [0x0040, 'UDS_HORZ'], _
    [0x0020, 'UDS_ARROWKEYS'], _
    [0x0010, 'UDS_AUTOBUDDY'], _
    [0x0008, 'UDS_ALIGNLEFT'], _
    [0x0004, 'UDS_ALIGNRIGHT'], _
    [0x0002, 'UDS_SETBUDDYINT'], _
    [0x0001, 'UDS_WRAP']]


#EndRegion ; GUIStyles.inc.au3

; ===============================================================================================================================

; #CONSTANTS# ===================================================================================================================

;Global Const $DWMWA_USE_IMMERSIVE_DARK_MODE = (@OSBuild <= 18985) ? 19 : 20            ; before this build set to 19, otherwise set to 20, no thanks Windaube to document anything ??

; _WinAPI_GetIsImmersiveColorUsingHighContrast($IMMERSIVE_HC_CACHE_MODE)
Global Const $IHCM_USE_CACHED_VALUE = 0
Global Const $IIHCM_REFRESH = 1

; _WinAPI_SetPreferredAppMode($PREFERREDAPPMODE)

Global Const $APPMODE_DEFAULT = 0
Global Const $APPMODE_ALLOWDARK = 1
Global Const $APPMODE_FORCEDARK = 2
Global Const $APPMODE_FORCELIGHT = 3
Global Const $APPMODE_MAX = 4

OnAutoItExitRegister(_CleanExit)

Func _CleanExit()
    If $g_hDateOldProc Then __WinAPI_SetWindowLong($g_hDate, $GWL_WNDPROC, $g_hDateOldProc)
    If $g_hDateProc_CB Then DllCallbackFree($g_hDateProc_CB)
    If $g_hBrushEdit Then __WinAPI_DeleteObject($g_hBrushEdit)
    If $g__ListView_wProcOld Then __WinAPI_SetWindowLong($hWndListView, $GWL_WNDPROC, $g__ListView_wProcOld)
    If $g__ListView_wProcNew Then DllCallbackFree($g__ListView_wProcNew)
    ; Restore the original window procedure for the tab control
    If $g_hProc Then __WinAPI_SetWindowLong($g_hTab, $GWL_WNDPROC, $g_hProc)
    If $g_hTab_CB Then DllCallbackFree($g_hTab_CB)
EndFunc

; ===============================================================================================================================
#EndRegion Global Variables and Constants

#Region API Functions

; #FUNCTION# ====================================================================================================================
; Name ..........: _WinAPI_ShouldAppsUseDarkMode
; Description ...: Checks if apps should use the dark mode.
; Syntax ........: _WinAPI_ShouldAppsUseDarkMode()
; Parameters ....: None
; Return values .: Success: Returns True if apps should use dark mode.
;                  Failure: Returns False and sets @error:
;                           -1: Operating system version is earlier than Windows 10 (version 1809, build 17763).
;                           Other values: DllCall error, check @error @extended for more information.
; Author ........: NoNameCode
; Modified ......:
; Remarks .......: Requires Windows 10 (version 1809, build 17763) or later.
; Related .......:
; Link ..........: http://www.opengate.at/blog/2021/08/dark-mode-win32/
; Example .......: No
; ===============================================================================================================================
Func _WinAPI_ShouldAppsUseDarkMode()
    If @OSBuild < 17763 Then Return SetError(-1, 0, False)

    Local $fnShouldAppsUseDarkMode = 132

    Local $aResult = DllCall($hUxthemeDll, 'bool', $fnShouldAppsUseDarkMode)
    If @error Then Return SetError(@error, @extended, False)

    Return $aResult[0]
EndFunc   ;==>_WinAPI_ShouldAppsUseDarkMode

; #FUNCTION# ====================================================================================================================
; Name ..........: _WinAPI_AllowDarkModeForWindow
; Description ...: Allows or disallows dark mode for a specific window handle.
; Syntax ........: _WinAPI_AllowDarkModeForWindow($hWnd, $bAllow = True)
; Parameters ....: $hWnd    - Handle to the window.
;                  $bAllow  - [optional] If True, allows dark mode; if False, disallows dark mode. Default is True.
; Return values .: Success: Returns True if the operation succeeded.
;                  Failure: Returns False and sets @error:
;                           -1: Operating system version is earlier than Windows 10 (version 1809, build 17763).
;                           Other values: DllCall error, check @error @extended for more information.
; Author ........: NoNameCode
; Modified ......:
; Remarks .......: Requires Windows 10 (version 1809, build 17763) or later.
; Related .......:
; Link ..........: http://www.opengate.at/blog/2021/08/dark-mode-win32/
; Example .......: No
; ===============================================================================================================================
Func _WinAPI_AllowDarkModeForWindow($hWnd, $bAllow = True)
    If @OSBuild < 17763 Then Return SetError(-1, 0, False)

    Local $fnAllowDarkModeForWindow = 133

    Local $aResult = DllCall($hUxthemeDll, 'bool', $fnAllowDarkModeForWindow, 'hwnd', $hWnd, 'bool', $bAllow)
    If @error Then Return SetError(@error, @extended, False)

    Return $aResult[0]
EndFunc   ;==>_WinAPI_AllowDarkModeForWindow

; #FUNCTION# ====================================================================================================================
; Name ..........: _WinAPI_AllowDarkModeForApp
; Description ...: Allows or disallows dark mode for the entire application.
; Syntax ........: _WinAPI_AllowDarkModeForApp($bAllow = True)
; Parameters ....: $bAllow  - [optional] If True, allows dark mode for the application; if False, disallows dark mode. Default is True.
; Return values .: Success: Returns True if the operation succeeded.
;                  Failure: Returns False and sets @error:
;                           -1: Operating system version is earlier than Windows 10 (version 1809, build 17763).
;                           -2: Operating system version is later than or equal to Windows 10 (version 1903, build 18362). (Use _WinAPI_SetPreferredAppMode instat!)
;                           Other values: DllCall error, check @error @extended for more information.
; Author ........: NoNameCode
; Modified ......:
; Remarks .......: Requires Windows 10 (version 1809, build 17763) and earlier than Windows 10 (version 1903, build 18362).
; Related .......: _WinAPI_SetPreferredAppMode
; Link ..........: http://www.opengate.at/blog/2021/08/dark-mode-win32/
; Example .......: No
; ===============================================================================================================================
Func _WinAPI_AllowDarkModeForApp($bAllow = True)
    If @OSBuild < 17763 Then Return SetError(-1, 0, False)
    If @OSBuild >= 18362 Then Return SetError(-2, 0, False)

    Local $fnAllowDarkModeForApp = 135

    Local $aResult = DllCall($hUxthemeDll, 'bool', $fnAllowDarkModeForApp, 'bool', $bAllow)
    If @error Then Return SetError(@error, @extended, False)

    Return $aResult[0]
EndFunc   ;==>_WinAPI_AllowDarkModeForApp

; #FUNCTION# ====================================================================================================================
; Name ..........: _WinAPI_FlushMenuThemes
; Description ...: Refreshes the system's immersive color policy state, allowing changes to take effect.
; Syntax ........: _WinAPI_FlushMenuThemes()
; Parameters ....: None
; Return values .: Success: True
;                  Failure: False and sets the @error flag:
;                           -1: Operating system version is earlier than Windows 10 (version 17763)
;                           Other values: DllCall error, check @error @extended for more information.
; Author ........: NoNameCode
; Modified ......:
; Remarks .......: This function is applicable for Windows 10 (version 17763) and later.
; Related .......:
; Link ..........: http://www.opengate.at/blog/2021/08/dark-mode-win32/
; Example .......: No
; ===============================================================================================================================
Func _WinAPI_FlushMenuThemes()
    If @OSBuild < 17763 Then Return SetError(-1, 0, False)

    Local $fnFlushMenuThemes = 136

    DllCall($hUxthemeDll, 'none', $fnFlushMenuThemes)
    If @error Then Return SetError(@error, @extended, False)

    Return True
EndFunc   ;==>_WinAPI_FlushMenuThemes

; #FUNCTION# ====================================================================================================================
; Name ..........: _WinAPI_RefreshImmersiveColorPolicyState
; Description ...: Refreshes the system's immersive color policy state, allowing changes to take effect.
; Syntax ........: _WinAPI_RefreshImmersiveColorPolicyState()
; Parameters ....: None
; Return values .: Success: True
;                  Failure: False and sets the @error flag:
;                           -1: Operating system version is earlier than Windows 10 (version 17763)
;                           Other values: DllCall error, check @error @extended for more information.
; Author ........: NoNameCode
; Modified ......:
; Remarks .......: This function is applicable for Windows 10 (version 17763) and later.
; Related .......:
; Link ..........: http://www.opengate.at/blog/2021/08/dark-mode-win32/
; Example .......: No
; ===============================================================================================================================
Func _WinAPI_RefreshImmersiveColorPolicyState()
    If @OSBuild < 17763 Then Return SetError(-1, 0, False)

    Local $fnRefreshImmersiveColorPolicyState = 104

    DllCall($hUxthemeDll, 'none', $fnRefreshImmersiveColorPolicyState)
    If @error Then Return SetError(@error, @extended, False)

    Return True
EndFunc   ;==>_WinAPI_RefreshImmersiveColorPolicyState

; #FUNCTION# ====================================================================================================================
; Name ..........: _WinAPI_IsDarkModeAllowedForWindow
; Description ...: Checks if the dark mode is allowed for the specified window.
; Syntax ........: _WinAPI_IsDarkModeAllowedForWindow()
; Parameters ....: None
; Return values .: Success: True if dark mode is allowed for the window, False otherwise.
;                  Failure: False and sets the @error flag:
;                           -1: Operating system version is earlier than Windows 10 (version 17763)
;                           Other values: DllCall error, check @error @extended for more information.
; Author ........: NoNameCode
; Modified ......:
; Remarks .......: This function is applicable for Windows 10 (version 17763) and later.
; Related .......:
; Link ..........: http://www.opengate.at/blog/2021/08/dark-mode-win32/
; Example .......: No
; ===============================================================================================================================
Func _WinAPI_IsDarkModeAllowedForWindow()
    If @OSBuild < 17763 Then Return SetError(-1, 0, False)

    Local $fnIsDarkModeAllowedForWindow = 137

    Local $aResult = DllCall($hUxthemeDll, 'bool', $fnIsDarkModeAllowedForWindow)
    If @error Then Return SetError(@error, @extended, False)

    Return $aResult[0]
EndFunc   ;==>_WinAPI_IsDarkModeAllowedForWindow

; #FUNCTION# ====================================================================================================================
; Name ..........: _WinAPI_GetIsImmersiveColorUsingHighContrast
; Description ...: Retrieves whether immersive color is using high contrast.
; Syntax ........: _WinAPI_GetIsImmersiveColorUsingHighContrast($IMMERSIVE_HC_CACHE_MODE)
; Parameters ....: $IMMERSIVE_HC_CACHE_MODE - The cache mode. Use one of the following values:
;                    $IHCM_USE_CACHED_VALUE (0) - Use the cached value. (Default)
;                    $IHCM_REFRESH (1) - Refresh the value.
; Return values .: Success: True if immersive color is using high contrast.
;                  Failure: False and sets the @error flag:
;                           -1: Operating system version is earlier than Windows 10 (version 17763)
;                           Other values: DllCall error, check @error @extended for more information.
; Author ........: NoNameCode
; Modified ......:
; Remarks .......: This function is applicable for Windows 10 (version 17763) and later.
; Related .......:
; Link ..........: http://www.opengate.at/blog/2021/08/dark-mode-win32/
; Example .......: No
; ===============================================================================================================================
Func _WinAPI_GetIsImmersiveColorUsingHighContrast($IMMERSIVE_HC_CACHE_MODE = $IHCM_USE_CACHED_VALUE)
    If @OSBuild < 17763 Then Return SetError(-1, 0, False)

    Local $fnGetIsImmersiveColorUsingHighContrast = 106

    Local $aResult = DllCall($hUxthemeDll, 'bool', $fnGetIsImmersiveColorUsingHighContrast, 'int', $IMMERSIVE_HC_CACHE_MODE)
    If @error Then Return SetError(@error, @extended, False)

    Return $aResult[0]
EndFunc   ;==>_WinAPI_GetIsImmersiveColorUsingHighContrast

; #FUNCTION# ====================================================================================================================
; Name ..........: _WinAPI_OpenNcThemeData
; Description ...: Opens the theme data for a window.
; Syntax ........: _WinAPI_OpenNcThemeData($hWnd, $pClassList)
; Parameters ....: $hWnd - Handle to the window.
;                  $sClassList - String that contains a semicolon-separated list of classes.
; Return values .: Success: A handle to the theme data.
;                  Failure: 0 and sets the @error flag:
;                           -1: Operating system version is earlier than Windows 10 (version 17763)
;                           Other values: DllCall error, check @error @extended for more information.
; Author ........: NoNameCode
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........: https://github.com/ysc3839/win32-darkmode/blob/master/win32-darkmode/DarkMode.h#L69
; Example .......: No
; ===============================================================================================================================
Func _WinAPI_OpenNcThemeData($hWnd, $sClassList)
    If @OSBuild < 17763 Then Return SetError(-1, 0, False)

    Local $fnOpenNcThemeData = 49

    Local $aResult = DllCall($hUxthemeDll, 'hwnd', $fnOpenNcThemeData, 'hwnd', $hWnd, 'wstr', $sClassList)
    If @error Then Return SetError(@error, @extended, 0)

    Return $aResult[0]
EndFunc   ;==>_WinAPI_OpenNcThemeData

; #FUNCTION# ====================================================================================================================
; Name ..........: _WinAPI_ShouldSystemUseDarkMode
; Description ...: Checks if system should use the dark mode.
; Syntax ........: _WinAPI_ShouldSystemUseDarkMode()
; Parameters ....: None
; Return values .: Success: Returns True if system should use dark mode.
;                  Failure: Returns False and sets @error:
;                           -1: Operating system version is earlier than Windows 10 (version 1903, build 18362).
;                           Other values: DllCall error, check @error @extended for more information.
; Author ........: NoNameCode
; Modified ......:
; Remarks .......: Requires Windows 10 (version 1903, build 18362) or later.
; Related .......:
; Link ..........: http://www.opengate.at/blog/2021/08/dark-mode-win32/
; Example .......: No
; ===============================================================================================================================
Func _WinAPI_ShouldSystemUseDarkMode()
    If @OSBuild < 18362 Then Return SetError(-1, 0, False)

    Local $fnShouldSystemUseDarkMode = 138

    Local $aResult = DllCall($hUxthemeDll, 'bool', $fnShouldSystemUseDarkMode)
    If @error Then Return SetError(@error, @extended, False)

    Return $aResult[0]
EndFunc   ;==>_WinAPI_ShouldSystemUseDarkMode

; #FUNCTION# ====================================================================================================================
; Name ..........: _WinAPI_SetPreferredAppMode
; Description ...: Sets the preferred application mode for Windows 10 (version 1903, build 18362) and later.
; Syntax ........: _WinAPI_SetPreferredAppMode($PREFERREDAPPMODE)
; Parameters ....: $PREFERREDAPPMODE - The preferred application mode. See enum PreferredAppMode for possible values.
;                    $APPMODE_DEFAULT (0)
;                    $APPMODE_ALLOWDARK (1)
;                    $APPMODE_FORCEDARK (2)
;                    $APPMODE_FORCELIGHT (3)
;                    $APPMODE_MAX (4)
; Return values .: Success: The PreferredAppMode retuned by the DllCall
;                  Failure: '' and sets the @error flag:
;                           -1: Operating system version is earlier than Windows 10 (version 18362)
;                           Other values: DllCall error, check @error @extended for more information.
; Author ........: NoNameCode
; Modified ......:
; Remarks .......: This function is applicable for Windows 10 (version 18362) and later.
; Related .......: _WinAPI_AllowDarkModeForApp
; Link ..........: http://www.opengate.at/blog/2021/08/dark-mode-win32/
; Example .......: No
; ===============================================================================================================================
Func _WinAPI_SetPreferredAppMode($PREFERREDAPPMODE)
    If @OSBuild < 18362 Then Return SetError(-1, 0, False)

    Local $fnSetPreferredAppMode = 135

    Local $aResult = DllCall($hUxthemeDll, 'int', $fnSetPreferredAppMode, 'int', $PREFERREDAPPMODE)
    If @error Then Return SetError(@error, @extended, '')

    Return $aResult[0]
EndFunc   ;==>_WinAPI_SetPreferredAppMode

Func _WinAPI_FindWindowEx($hParent, $hAfter, $sClass, $sTitle = "")
    Local $ret = DllCall($hUser32Dll, "hwnd", "FindWindowExW", "hwnd", $hParent, "hwnd", $hAfter, "wstr", $sClass, "wstr", $sTitle)
    If @error Or Not IsArray($ret) Then Return 0
    Return $ret[0]
EndFunc   ;==>_WinAPI_FindWindowEx

#EndRegion API Functions

#Region Internal Functions

; #FUNCTION# ====================================================================================================================
; Name ..........: _WinAPI_DwmSetWindowAttribute_unr
; Description ...: Dose the same as _WinAPI_DwmSetWindowAttribute; But has no Restrictions
; Syntax ........: _WinAPI_DwmSetWindowAttribute_unr($hWnd, $iAttribute, $iData)
; Parameters ....: $hWnd                - a handle value.
;                  $iAttribute          - an integer value.
;                  $iData               - an integer value.
; Return values .: Success: 1 Failure: @error, @extended & False
; Author ........: argumentum
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........: https://www.autoitscript.com/forum/topic/211475-winapithemeex-darkmode-for-autoits-win32guis/?do=findComment&comment=1530103
; Example .......: No
; ===============================================================================================================================
Func _WinAPI_DwmSetWindowAttribute_unr($hWnd, $iAttribute, $iData) ; #include <WinAPIGdi.au3> ; unthoughtful unrestricting mod.
    Local $aCall = DllCall('dwmapi.dll', 'long', 'DwmSetWindowAttribute', 'hwnd', $hWnd, 'dword', $iAttribute, _
            'dword*', $iData, 'dword', 4)
    If @error Then Return SetError(@error, @extended, 0)
    If $aCall[0] Then Return SetError(10, $aCall[0], 0)
    Return 1
EndFunc   ;==>_WinAPI_DwmSetWindowAttribute_unr

#EndRegion Internal Functions

#cs
Func _ColorToCOLORREF($iColor) ;RGB to BGR
    Local $iR = BitAND(BitShift($iColor, 16), 0xFF)
    Local $iG = BitAND(BitShift($iColor, 8), 0xFF)
    Local $iB = BitAND($iColor, 0xFF)
    Return BitOR(BitShift($iB, -16), BitShift($iG, -8), $iR)
EndFunc   ;==>_ColorToCOLORREF
#ce

Func _WM_CTLCOLOR($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg
    Local $hDC = $wParam
    Local $hCtrl = $lParam

    Switch __WinAPI_GetClassName($hCtrl)
        Case 'Static'
            ; set transparent background
        __WinAPI_SetBkMode($hDC, $TRANSPARENT)
        ; set text color (if necessary) - e.g., white
        __WinAPI_SetTextColor($hDC, _ColorToCOLORREF($COLOR_TEXT_LIGHT))
        ; return NULL_BRUSH (stock object), so Windows does NOT fill with your dark brush
        Local $hNull = __WinAPI_GetStockObject(5) ; 5 = NULL_BRUSH
        If $hNull Then Return $hNull
        ; Fallback if not available:
        Return $GUI_RUNDEFMSG
    EndSwitch

    ; --- Default behavior for all other statics / controls ---
    __WinAPI_SetTextColor($hDC, _ColorToCOLORREF($COLOR_TEXT_LIGHT))

    Local $hBrush = $g_hBrushEdit

    _WinAPI_SetBkColor($hDC, _ColorToCOLORREF($COLOR_CONTROL_BG))
    __WinAPI_SetBkMode($hDC, $TRANSPARENT)

    Return $hBrush
EndFunc   ;==>_WM_CTLCOLOR

Func _WinProc($hWnd, $iMsg, $wParam, $lParam)
    ; Custom window procedure for tab control with Dark Mode
    Switch $iMsg
        Case $WM_ERASEBKGND
            Return 1 ; Prevent background erase to avoid flicker

        Case $WM_PAINT
            Local $tPaint = DllStructCreate($tagPAINTSTRUCT)
            Local $hDC = DllCall($hUser32Dll, "handle", "BeginPaint", "hwnd", $hWnd, "struct*", $tPaint)
            If @error Or Not $hDC[0] Then Return __WinAPI_CallWindowProc($g_hProc, $hWnd, $iMsg, $wParam, $lParam)
            $hDC = $hDC[0]

            ; Get client rectangle
            Local $tClient = __WinAPI_GetClientRect($hWnd)
            If Not IsDllStruct($tClient) Then
                __WinAPI_EndPaint($hWnd, $tPaint)
                Return 0
            EndIf

            Local $iWidth = $tClient.Right
            Local $iHeight = $tClient.Bottom

            ; Create memory DC for double buffering
            Local $hMemDC = __WinAPI_CreateCompatibleDC($hDC)
            Local $hBitmap = __WinAPI_CreateCompatibleBitmap($hDC, $iWidth, $iHeight)
            Local $hOldBmp = __WinAPI_SelectObject($hMemDC, $hBitmap)

            ; Fill background but exclude overlapping GUI controls from painting
            Local $hParent = __WinAPI_GetParent($hWnd)
            Local $hChild  = __WinAPI_GetWindow($hParent, $GW_CHILD)
            Local $tCR, $tPR = __WinAPI_GetWindowRect($hWnd)
            Local $left, $top, $right, $bottom

            While $hChild
                If $hChild <> $hWnd And __WinAPI_IsWindowVisible($hChild) Then
                    $tCR = __WinAPI_GetWindowRect($hChild)
                    ; Only exclude controls that lie fully within the tab control area
                    If $tCR.left >= $tPR.left And $tCR.right <= $tPR.right And $tCR.top >= $tPR.top And $tCR.bottom <= $tPR.bottom Then
                        $left = $tCR.left - $tPR.left
                        $top = $tCR.top - $tPR.top
                        $right = $tCR.right - $tPR.left
                        $bottom = $tCR.bottom - $tPR.top
                        ; Exclude from offscreen bitmap (prevents black fill)
                        DllCall($hGdi32Dll, "int", "ExcludeClipRect", "handle", $hMemDC, "int", $left, "int", $top, "int", $right, "int", $bottom)
                        ; Exclude from screen DC (prevents BitBlt overwrite)
                        DllCall($hGdi32Dll, "int", "ExcludeClipRect", "handle", $hDC, "int", $left, "int", $top, "int", $right, "int", $bottom)
                    EndIf
                EndIf
                $hChild = __WinAPI_GetWindow($hChild, $GW_HWNDNEXT)
            WEnd

            ; Fill background
            Local $hBrush = __WinAPI_CreateSolidBrush(_ColorToCOLORREF($COLOR_CONTROL_BG))
            __WinAPI_FillRect($hMemDC, $tClient, $hBrush)
            __WinAPI_DeleteObject($hBrush)

            ; Get tab info
            Local $iTabCount = __SendMessage($hWnd, $TCM_GETITEMCOUNT, 0, 0)
            Local $iCurSel = __SendMessage($hWnd, $TCM_GETCURSEL, 0, 0)

            ; Setup font
            Local $hFont = __SendMessage($hWnd, $WM_GETFONT, 0, 0)
            If Not $hFont Then $hFont = __WinAPI_GetStockObject($DEFAULT_GUI_FONT)
            Local $hOldFont = __WinAPI_SelectObject($hMemDC, $hFont)

            __WinAPI_SetBkMode($hMemDC, $TRANSPARENT)
            __WinAPI_SetTextColor($hMemDC, _ColorToCOLORREF($COLOR_TEXT_LIGHT))

            ; Draw each tab
            Local $tRect, $iLeft, $iTop, $iRight, $iBottom, $tItem, $tText, $bSelected, $iTabColor, $hTabBrush, $tTabRect, _
                  $sText, $hPen, $hOldPen, $hPenSep,$hOldPenSep, $tTextRect, $hBorderPen, $hOldBorderPen, $hNullBrush, $hOldBorderBrush

            For $i = 0 To $iTabCount - 1
                ; Get tab rectangle using TCM_GETITEMRECT
                $tRect = DllStructCreate($tagRECT)
                Local $aResult = DllCall($hUser32Dll, "lresult", "SendMessageW", _
                                                            "hwnd", $hWnd, _
                                                            "uint", $TCM_GETITEMRECT, _
                                                            "wparam", $i, _
                                                            "struct*", $tRect)
                If @error Or Not $aResult[0] Then ContinueLoop

                $iLeft = $tRect.Left
                $iTop = $tRect.Top
                $iRight = $tRect.Right
                $iBottom = $tRect.Bottom

                ; Skip if rectangle is invalid
                If $iLeft >= $iRight Or $iTop >= $iBottom Then ContinueLoop

                ; Get tab text
                $tItem = DllStructCreate("uint Mask;dword dwState;dword dwStateMask;ptr pszText;int cchTextMax;int iImage;lparam lParam")
                $tText = DllStructCreate("wchar Text[256]")
                With $tItem
                    .Mask = 0x0001 ; TCIF_TEXT
                    .pszText = DllStructGetPtr($tText)
                    .cchTextMax = 256
                EndWith

                DllCall($hUser32Dll, "lresult", "SendMessageW", _
                                                "hwnd", $hWnd, _
                                                "uint", $TCM_GETITEMW, _
                                                "wparam", $i, _
                                                "struct*", $tItem)

                $sText = DllStructGetData($tText, "Text")

                ; Draw tab background
                $bSelected = ($i = $iCurSel)
                $iTabColor = $bSelected ? __WinAPI_ColorAdjustLuma($COLOR_CONTROL_BG, 20) : __WinAPI_ColorAdjustLuma($COLOR_CONTROL_BG, 10)
                $hTabBrush = __WinAPI_CreateSolidBrush($iTabColor)

                $tTabRect = DllStructCreate($tagRECT)
                With $tTabRect
                    .Left = $iLeft
                    .Top = $iTop
                    .Right = $iRight
                    .Bottom = $iBottom
                EndWith

                __WinAPI_FillRect($hMemDC, $tTabRect, $hTabBrush)
                __WinAPI_DeleteObject($hTabBrush)

                ; Draw selection indicator (top border for selected tab)
                If $bSelected Then
                    $hPen = __WinAPI_CreatePen(0, 2, _ColorToCOLORREF(0x0078D4)) ; Blue accent
                    $hOldPen = __WinAPI_SelectObject($hMemDC, $hPen)
                    __WinAPI_MoveTo($hMemDC, $iLeft, $iTop)
                    __WinAPI_LineTo($hMemDC, $iRight - 2, $iTop)
                    __WinAPI_SelectObject($hMemDC, $hOldPen)
                    __WinAPI_DeleteObject($hPen)
                EndIf

                ; Draw separator between tabs
                If $i < $iTabCount - 1 Then
                    $hPenSep = __WinAPI_CreatePen(0, 1, _ColorToCOLORREF($COLOR_BORDER))
                    $hOldPenSep = __WinAPI_SelectObject($hMemDC, $hPenSep)
                    __WinAPI_MoveTo($hMemDC, $iRight - 1, $iTop + 4)
                    __WinAPI_LineTo($hMemDC, $iRight - 1, $iBottom - 4)
                    __WinAPI_SelectObject($hMemDC, $hOldPenSep)
                    __WinAPI_DeleteObject($hPenSep)
                EndIf

                ; Draw text centered in tab
                $tTextRect = DllStructCreate($tagRECT)
                With $tTextRect
                    .Left = $iLeft + 6
                    .Top = $iTop + 3
                    .Right = $iRight - 6
                    .Bottom = $iBottom - 3
                EndWith
                DllCall($hUser32Dll, "int", "DrawTextW", _
                                            "handle", $hMemDC, _
                                            "wstr", $sText, _
                                            "int", -1, _
                                            "struct*", $tTextRect, _
                                            "uint", BitOR($DT_CENTER, $DT_VCENTER, $DT_SINGLELINE))
            Next

            ; Draw border around entire control
            $hBorderPen = __WinAPI_CreatePen(0, 1, _ColorToCOLORREF($COLOR_BORDER))
            $hOldBorderPen = __WinAPI_SelectObject($hMemDC, $hBorderPen)
            $hNullBrush = __WinAPI_GetStockObject(5) ; NULL_BRUSH
            $hOldBorderBrush = __WinAPI_SelectObject($hMemDC, $hNullBrush)

            DllCall($hGdi32Dll, "bool", "Rectangle", "handle", $hMemDC, "int", 0, "int", 0, "int", $iWidth, "int", $iHeight)

            __WinAPI_SelectObject($hMemDC, $hOldBorderPen)
            __WinAPI_SelectObject($hMemDC, $hOldBorderBrush)
            __WinAPI_DeleteObject($hBorderPen)

            ; Copy to screen
            __WinAPI_BitBlt($hDC, 0, 0, $iWidth, $iHeight, $hMemDC, 0, 0, $SRCCOPY)

            ; Cleanup
            __WinAPI_SelectObject($hMemDC, $hOldFont)
            __WinAPI_SelectObject($hMemDC, $hOldBmp)
            __WinAPI_DeleteObject($hBitmap)
            __WinAPI_DeleteDC($hMemDC)

            __WinAPI_EndPaint($hWnd, $tPaint)
            Return 0
    EndSwitch

    Return __WinAPI_CallWindowProc($g_hProc, $hWnd, $iMsg, $wParam, $lParam)
EndFunc   ;==>_WinProc

Func _LVWndProc($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam
    If $iMsg = $WM_NOTIFY Then
        Local $tNMHDR, $hWndFrom, $iCode, $hDC
        $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
        $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
        $iCode = DllStructGetData($tNMHDR, "Code")

        Switch $hWndFrom
            Case $hWndListViewHeader
                Switch $iCode
                    Case $NM_CUSTOMDRAW
                        Local $tCustDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam)
                        Switch DllStructGetData($tCustDraw, "dwDrawStage")
                            Case $CDDS_PREPAINT
                                Return $CDRF_NOTIFYITEMDRAW
                            Case $CDDS_ITEMPREPAINT
                                $hDC = DllStructGetData($tCustDraw, "hDC")
                                DllCall($hGdi32Dll, "int", "SetTextColor", "handle", $hDC, "dword", __WinAPI_SwitchColor($COLOR_TEXT_LIGHT))
                                Return $CDRF_NEWFONT
                                Return $CDRF_SKIPDEFAULT
                        EndSwitch
                EndSwitch
        EndSwitch
    EndIf
    ;pass the unhandled messages to default WindowProc
    Local $aResult = DllCall($hUser32Dll, "lresult", "CallWindowProcW", "ptr", $g__ListView_wProcOld, _
            "hwnd", $hWnd, "uint", $iMsg, "wparam", $wParam, "lparam", $lParam)
    If @error Then Return -1
    Return $aResult[0]
EndFunc   ;==>_LVWndProc

#Region WM_NOTIFY

Func _DateProc($hWnd, $iMsg, $wParam, $lParam)
    Local $iRet
    Switch $iMsg

        Case $WM_PAINT
            Local $tPaint = DllStructCreate($tagPAINTSTRUCT)
            Local $hDC = __WinAPI_BeginPaint($hWnd, $tPaint)

            Local $tClient = __WinAPI_GetClientRect($hWnd)
            Local $iW = $tClient.Right
            Local $iH = $tClient.Bottom

            ; --- Memory DC for flicker-free rendering ---
            Local $hMemDC = __WinAPI_CreateCompatibleDC($hDC)
            Local $hBitmap = __WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH)
            Local $hOldBmp = __WinAPI_SelectObject($hMemDC, $hBitmap)

            ; 1. Let Windows draw the light-mode control into memory DC
            __WinAPI_CallWindowProc($g_hDateOldProc, $hWnd, $WM_PRINTCLIENT, $hMemDC, $PRF_CLIENT)

            ; 2. Invert all pixels (background becomes black, text white, selection orange)
            Local $tRect = DllStructCreate($tagRECT)
            $tRect.right = $iW
            $tRect.bottom = $iH
            __WinAPI_InvertRect($hMemDC, $tRect)

            ; --- 3. PIXEL HACK: destroy orange highlight & set background color ---
            Local $iSize = $iW * $iH
            Local $tPixels = DllStructCreate("dword c[" & $iSize & "]")
            ; Load pixel array directly from bitmap memory
            Local $iBytes = DllCall($hGdi32Dll, "long", "GetBitmapBits", "handle", $hBitmap, "long", $iSize * 4, "ptr", DllStructGetPtr($tPixels))[0]

            If $iBytes = $iSize * 4 Then
                Local $iPixel, $r, $g, $b, $iGray
                For $i = 1 To $iSize
                    $iPixel = $tPixels.c(($i))

                    ; Split into color channels
                    $b = BitAND($iPixel, 0xFF)
                    $g = BitAND(BitShift($iPixel, 8), 0xFF)
                    $r = BitAND(BitShift($iPixel, 16), 0xFF)

                    ; Convert to grayscale (orange becomes mid-gray)
                    $iGray = Int(($r + $g + $b) / 3)

                    ; Very dark pixel = inverted white background
                    If $iGray < 15 Then
                        $iPixel = $DTP_BG_DARK ; Replace with exact GUI background color
                    Else
                        ; Grayscale value for text (white) and selection (gray)
                        ; (negative BitShift shifts left in AutoIt)
                        $iPixel = BitOR(BitShift($iGray, -16), BitShift($iGray, -8), $iGray)
                    EndIf

                    $tPixels.c(($i)) = $iPixel
                Next
                ; Write cleaned pixels back into the bitmap
                DllCall($hGdi32Dll, "long", "SetBitmapBits", "handle", $hBitmap, "long", $iSize * 4, "ptr", DllStructGetPtr($tPixels))
            EndIf
            ; --- END PIXEL HACK ---

            ; --- Border color (hover effect) ---
            Local $iBorderColor = $DTP_BORDER
            If __WinAPI_GetFocus() = $hWnd Then $iBorderColor = $DTP_BORDER
            Local $tCursorPos = DllStructCreate($tagPOINT)
            DllCall($hUser32Dll, "bool", "GetCursorPos", "struct*", $tCursorPos)
            DllCall($hUser32Dll, "bool", "ScreenToClient", "hwnd", $hWnd, "struct*", $tCursorPos)
            If $tCursorPos.X >= 0 And $tCursorPos.X <= $iW And $tCursorPos.Y >= 0 And $tCursorPos.Y <= $iH Then
                $iBorderColor = $DTP_BORDER_LIGHT
            EndIf

            ; --- Draw border ---
            Local $hPen = __WinAPI_CreatePen(0, 1, _ColorToCOLORREF($iBorderColor))
            Local $hNullBr = __WinAPI_GetStockObject(5)
            Local $hOldPen = __WinAPI_SelectObject($hMemDC, $hPen)
            Local $hOldBr = __WinAPI_SelectObject($hMemDC, $hNullBr)
            DllCall($hGdi32Dll, "bool", "Rectangle", "handle", $hMemDC, "int", 0, "int", 0, "int", $iW, "int", $iH)
            __WinAPI_SelectObject($hMemDC, $hOldPen)
            __WinAPI_SelectObject($hMemDC, $hOldBr)
            __WinAPI_DeleteObject($hPen)

            ; --- Copy finished result to screen in one step (no flicker) ---
            __WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hMemDC, 0, 0, $SRCCOPY)

            ; --- Cleanup ---
            __WinAPI_SelectObject($hMemDC, $hOldBmp)
            __WinAPI_DeleteObject($hBitmap)
            __WinAPI_DeleteDC($hMemDC)
            __WinAPI_EndPaint($hWnd, $tPaint)
            Return 0

        Case $WM_ERASEBKGND
            Return 1

        Case $WM_SETFOCUS, $WM_KILLFOCUS, $WM_LBUTTONDOWN, $WM_LBUTTONUP
            $iRet = __WinAPI_CallWindowProc($g_hDateOldProc, $hWnd, $iMsg, $wParam, $lParam)
            __WinAPI_InvalidateRect($hWnd, 0, False)
            Return $iRet

        Case $WM_MOUSEMOVE
            $iRet = __WinAPI_CallWindowProc($g_hDateOldProc, $hWnd, $iMsg, $wParam, $lParam)
            If Not $g_bHover Then
                $g_bHover = True
                __WinAPI_InvalidateRect($hWnd, 0, False)
            EndIf
            Return $iRet

        Case $WM_MOUSELEAVE
            $g_bHover = False
            __WinAPI_InvalidateRect($hWnd, 0, False)

    EndSwitch

    Return __WinAPI_CallWindowProc($g_hDateOldProc, $hWnd, $iMsg, $wParam, $lParam)
EndFunc   ;==>_DateProc

Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam
    Local Static $iTheme  ; argumentum
    Local $hWndFrom, $iCode, $tNMHDR, $iCtrl
    $tNMHDR   = DllStructCreate($tagNMHDR, $lParam)
    $hWndFrom = HWnd($tNMHDR.hWndFrom)
    $iCode    = $tNMHDR.Code

    ; --- Slider (msctls_trackbar32) custom drawing ---
    If $iCode = $NM_CUSTOMDRAW And StringLower(__WinAPI_GetClassName($hWndFrom)) = "msctls_trackbar32" Then
        Local $tNMCD      = DllStructCreate($tagNMCUSTOMDRAW, $lParam)
        Local $dwStage    = $tNMCD.dwDrawStage
        Local $hDC        = $tNMCD.hdc
        Local $dwItemSpec = $tNMCD.dwItemSpec

        Switch $dwStage
            Case $CDDS_PREPAINT
                ; Remove focus rectangle from slider
                DllStructSetData($tNMCD, 'ItemState', BitXOR(DllStructGetData($tNMCD, 'ItemState'), $CDIS_FOCUS))
                Return $CDRF_NOTIFYITEMDRAW ; request per-item notifications

            Case $CDDS_ITEMPREPAINT
                Local Const $TBCD_TICS    = 0x0001 ; tick marks
                Local Const $TBCD_THUMB   = 0x0002 ; draggable thumb
                Local Const $TBCD_CHANNEL = 0x0003 ; slider channel/track

                Local $tRect = DllStructCreate($tagRECT)
                $tRect.left   = $tNMCD.left
                $tRect.top    = $tNMCD.top
                $tRect.right  = $tNMCD.right
                $tRect.bottom = $tNMCD.bottom

                Switch $dwItemSpec
                    Case $TBCD_TICS
                        ; Let Windows draw tick marks normally
                        Return $CDRF_DODEFAULT

                    Case $TBCD_THUMB
                        ; Draw thumb as a pentagon (rectangle + downward arrow)
                        Local $iL     = $tNMCD.left
                        Local $iT     = $tNMCD.top
                        Local $iR     = $tNMCD.right - 1 ; -1 to stay within bounds and avoid paint artifacts
                        Local $iB     = $tNMCD.bottom
                        Local $iMid   = ($iL + $iR) / 2       ; horizontal center (tip of arrow)
                        Local $iSplit = $iB - ($iR - $iL) / 2 ; y-position where rectangle ends and arrow begins

                        ; Pentagon points: top-left, top-right, right-middle, bottom-tip, left-middle
                        Local $tPoints = DllStructCreate("int p[10]")
                        $tPoints.p((1))  = $iL
                        $tPoints.p((2))  = $iT
                        $tPoints.p((3))  = $iR
                        $tPoints.p((4))  = $iT
                        $tPoints.p((5))  = $iR
                        $tPoints.p((6))  = $iSplit
                        $tPoints.p((7))  = $iMid
                        $tPoints.p((8))  = $iB
                        $tPoints.p((9))  = $iL
                        $tPoints.p((10)) = $iSplit

                        ; Fill and outline thumb with blue accent color
                        Local $hBrush    = __WinAPI_CreateSolidBrush(_ColorToCOLORREF(0x0078D4))
                        Local $hPen      = __WinAPI_CreatePen(0, 1, _ColorToCOLORREF($COLOR_CONTROL_BG))
                        Local $hOldBrush = __WinAPI_SelectObject($hDC, $hBrush)
                        Local $hOldPen   = __WinAPI_SelectObject($hDC, $hPen)
                        DllCall($hGdi32Dll, "bool", "Polygon", "handle", $hDC, "struct*", $tPoints, "int", 5)
                        __WinAPI_SelectObject($hDC, $hOldBrush)
                        __WinAPI_SelectObject($hDC, $hOldPen)
                        __WinAPI_DeleteObject($hBrush)
                        __WinAPI_DeleteObject($hPen)
                        Return $CDRF_SKIPDEFAULT ; skip default drawing

                    Case $TBCD_CHANNEL
                        ; Fill channel with border color
                        Local $hBrushChan = __WinAPI_CreateSolidBrush(_ColorToCOLORREF($COLOR_BORDER))
                        __WinAPI_FillRect($hDC, $tRect, $hBrushChan)
                        __WinAPI_DeleteObject($hBrushChan)
                        Return $CDRF_SKIPDEFAULT ; skip default drawing

                EndSwitch
        EndSwitch
    EndIf

    ; --- Per-control notification handling ---
    Switch $hWndFrom
        Case $g_hDate ;thanks to argumentum for the code :-)
            Switch $iCode
                Case $NM_SETFOCUS
                    $iTheme = __WinAPI_GetThemeAppProperties() ; argumentum
                    ; Disable the visual theme when the DateTime control receives focus
                    __WinAPI_SetThemeAppProperties(0)

                Case $DTN_DROPDOWN;, $EVENT_OBJECT_CREATE
                    ; Apply dark colors when the calendar dropdown appears
                    $iCtrl = _GUICtrlDTP_GetMonthCal($hWndFrom)
                    __WinAPI_SetWindowTheme($iCtrl, "", "")
                    _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TEXT, $COLOR_TEXT_LIGHT)
                    _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TITLEBK, $COLOR_CONTROL_BG)
                    _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TITLETEXT, $COLOR_TEXT_LIGHT)
                    _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_BACKGROUND, $COLOR_CONTROL_BG)
                    _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_MONTHBK, $COLOR_CONTROL_BG)
                    _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TRAILINGTEXT, $COLOR_TEXT_LIGHT)

                Case $DTN_CLOSEUP
                    ; Reset visual theme
                    __WinAPI_SetThemeAppProperties($iTheme)  ; argumentum
                    ; Calendar will closed

            EndSwitch
    EndSwitch

    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_NOTIFY

#EndRegion WM_NOTIFY

Func hWnd2Styles($hWnd)
    Return _GetCtrlStyleString(__WinAPI_GetWindowLong($hWnd, $GWL_STYLE), __WinAPI_GetWindowLong($hWnd, $GWL_EXSTYLE), __WinAPI_GetClassName($hWnd))
EndFunc

Func _GetStyleString($iStyle, $fExStyle)
    ConsoleWrite('+ Func _GetStyleString(' & $iStyle & ', ' & $fExStyle & ')' & @CRLF)
    Local $Text = '', $Data = $fExStyle ? $_g__Style_GuiExtended : $_g__Style_Gui

    For $i = 0 To UBound($Data) - 1
        If BitAND($iStyle, $Data[$i][0]) = $Data[$i][0] Then
            $iStyle = BitAND($iStyle, BitNOT($Data[$i][0]))
            If StringLeft($Data[$i][1], 1) <> "!" Then
                $Text &= $Data[$i][1] & ', '
            Else
                ; ex. '! WS_MINIMIZEBOX ! WS_GROUP'  =>  'WS_MINIMIZEBOX, '
                $Text &= StringMid($Data[$i][1], 3, StringInStr($Data[$i][1], "!", 2, 2) - 4) & ', '
            EndIf
        EndIf
    Next

    If $iStyle Then $Text = '0x' & Hex($iStyle, 8) & ', ' & $Text

    Return StringRegExpReplace($Text, ',\s\z', '')
EndFunc   ;==>_GetStyleString

Func _GetCtrlStyleString($iStyle, $fExStyle, $sClass, $iLVExStyle = 0)

    If $sClass = "AutoIt v3 GUI" Or $sClass = "#32770" Or $sClass = "MDIClient" Then ; control = child GUI, dialog box (msgbox) etc...
        Return _GetStyleString($iStyle, 0)
    EndIf

    If StringLeft($sClass, 8) = "RichEdit" Then $sClass = "RichEdit" ; RichEdit, RichEdit20A, RichEdit20W, RichEdit50A, RichEdit50W

    Local $Text = ''

    _GetCtrlStyleString2($iStyle, $Text, $sClass, $iLVExStyle) ; 4th param. in case $sClass = "Ex_SysListView32" (special treatment)

    If $sClass = "ReBarWindow32" Or $sClass = "ToolbarWindow32" Or $sClass = "msctls_statusbar32" Then
        $sClass = "Common" ; "for rebar controls, toolbar controls, and status windows" (msdn)
        _GetCtrlStyleString2($iStyle, $Text, $sClass)
    ElseIf $sClass = "RichEdit" Then
        $sClass = "Edit" ; "Richedit controls also support many edit control styles (not all)" (msdn)
        _GetCtrlStyleString2($iStyle, $Text, $sClass)
    EndIf

    Local $Data = $fExStyle ? $_g__Style_GuiExtended : $_g__Style_Gui

    For $i = 0 To UBound($Data) - 1
        If BitAND($iStyle, $Data[$i][0]) = $Data[$i][0] Then
            If (Not BitAND($Data[$i][0], 0xFFFF)) Or ($fExStyle) Then
                $iStyle = BitAND($iStyle, BitNOT($Data[$i][0]))
                If StringLeft($Data[$i][1], 1) <> "!" Then
                    $Text &= $Data[$i][1] & ', '
                Else
                    ; ex. '! WS_MINIMIZEBOX ! WS_GROUP'  =>  'WS_GROUP, '
                    $Text &= StringMid($Data[$i][1], StringInStr($Data[$i][1], "!", 2, 2) + 2) & ', '
                EndIf
            EndIf
        EndIf
    Next

    If $iStyle Then $Text = '0x' & Hex($iStyle, 8) & ', ' & $Text

    Return StringRegExpReplace($Text, ',\s\z', '')
EndFunc   ;==>_GetCtrlStyleString

;=====================================================================
Func _GetCtrlStyleString2(ByRef $iStyle, ByRef $Text, $sClass, $iLVExStyle = 0)

    Local $Data

    Switch $sClass  ; $Input[16]
        Case "Button"
            $Data = $_g__Style_Button
        Case "ComboBox", "ComboBoxEx32"
            $Data = $_g__Style_Combo
        Case "Common"
            $Data = $_g__Style_Common ; "for rebar controls, toolbar controls, and status windows (msdn)"
        Case "Edit"
            $Data = $_g__Style_Edit
        Case "ListBox"
            $Data = $_g__Style_ListBox
        Case "msctls_progress32"
            $Data = $_g__Style_Progress
        Case "msctls_statusbar32"
            $Data = $_g__Style_StatusBar
        Case "msctls_trackbar32"
            $Data = $_g__Style_Slider
        Case "msctls_updown32"
            $Data = $_g__Style_UpDown
        Case "ReBarWindow32"
            $Data = $_g__Style_Rebar
        Case "RichEdit"
            $Data = $_g__Style_RichEdit
        Case "Scrollbar"
            $Data = $_g__Style_Scrollbar
        Case "Static"
            $Data = $_g__Style_Static
        Case "SysAnimate32"
            $Data = $_g__Style_Avi
        Case "SysDateTimePick32"
            $Data = $_g__Style_DateTime
        Case "SysHeader32"
            $Data = $_g__Style_Header
        Case "SysListView32"
            $Data = $_g__Style_ListView
        Case "Ex_SysListView32" ; special treatment below
            $Data = $_g__Style_ListViewExtended
        Case "SysMonthCal32"
            $Data = $_g__Style_MonthCal
        Case "SysPager"
            $Data = $_g__Style_Pager
        Case "SysTabControl32", "SciTeTabCtrl"
            $Data = $_g__Style_Tab
        Case "SysTreeView32"
            $Data = $_g__Style_TreeView
        Case "ToolbarWindow32"
            $Data = $_g__Style_Toolbar
        Case Else
            Return
    EndSwitch

    If $sClass <> "Ex_SysListView32" Then
        For $i = 0 To UBound($Data) - 1
            If BitAND($iStyle, $Data[$i][0]) = $Data[$i][0] Then
                $iStyle = BitAND($iStyle, BitNOT($Data[$i][0]))
                $Text = $Data[$i][1] & ', ' & $Text
            EndIf
        Next
    Else
        For $i = 0 To UBound($Data) - 1
            If BitAND($iLVExStyle, $Data[$i][0]) = $Data[$i][0] Then
                $iLVExStyle = BitAND($iLVExStyle, BitNOT($Data[$i][0]))
                $Text = $Data[$i][1] & ', ' & $Text
                If BitAND($iStyle, $Data[$i][0]) = $Data[$i][0] Then
                    $iStyle = BitAND($iStyle, BitNOT($Data[$i][0]))
                EndIf
            EndIf
        Next
        If $iLVExStyle Then $Text = 'LVex: 0x' & Hex($iLVExStyle, 8) & ', ' & $Text
        ; next test bc LVS_EX_FULLROWSELECT (default AutoIt LV ext style) and WS_EX_TRANSPARENT got both same value 0x20 (hard to solve in some cases)
        If BitAND($iStyle, $WS_EX_TRANSPARENT) = $WS_EX_TRANSPARENT Then ; note that $WS_EX_TRANSPARENT has nothing to do with listview
            $iStyle = BitAND($iStyle, BitNOT($WS_EX_TRANSPARENT))
        EndIf
    EndIf
EndFunc   ;==>_GetCtrlStyleString2

#Region Public Functions

; #FUNCTION# ====================================================================================================================
; Name ..........: _GUISetDarkTheme
; Description ...: Sets the theme for a specified window to either dark or light mode on Windows 10.
; Syntax ........: _GUISetDarkTheme($hwnd, $dark_theme = True)
; Parameters ....: $hwnd          - The handle to the window.
;                  $dark_theme    - If True, sets the dark theme; if False, sets the light theme.
;                                   (Default is True for dark theme.)
; Return values .: None
; Author ........: DK12000, NoNameCode
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........: https://www.autoitscript.com/forum/topic/211196-gui-title-bar-dark-theme-an-elegant-solution-using-dwmapi/
; Example .......: No
; ===============================================================================================================================
Func _GUISetDarkTheme($hWnd, $bEnableDarkTheme = True)
    Local $iPreferredAppMode = ($bEnableDarkTheme == True) ? $APPMODE_FORCEDARK : $APPMODE_FORCELIGHT
    Local $iGUI_BkColor = ($bEnableDarkTheme == True) ? $COLOR_BG_DARK : _WinAPI_SwitchColor(_WinAPI_GetSysColor($COLOR_3DFACE))
    _WinAPI_SetPreferredAppMode($iPreferredAppMode)
    _WinAPI_RefreshImmersiveColorPolicyState()
    _WinAPI_FlushMenuThemes()
    GUISetBkColor($iGUI_BkColor, $hWnd)
    _GUICtrlSetDarkTheme($hWnd, $bEnableDarkTheme)          ;To Color the GUI's own Scrollbar
    _WinAPI_DwmSetWindowAttribute_unr($hWnd, $DWMWA_USE_IMMERSIVE_DARK_MODE, $bEnableDarkTheme)
EndFunc   ;==>_GUISetDarkTheme

; #FUNCTION# ====================================================================================================================
; Name ..........: _GUICtrlAllSetDarkTheme
; Description ...: Sets the dark theme to all existing sub Controls from a GUI
; Syntax ........: _GUICtrlAllSetDarkTheme($hGUI[, $bEnableDarkTheme = True, $bPreferNewTheme = False])
; Parameters ....: $hGUI                - GUI handle
;                  $bEnableDarkTheme    - [optional] a boolean value. Default is True.
;                  $bPreferNewTheme     - Prefer the newer DarkMode_DarkTheme theme over DarkMode_Explorer when possible.
;                                         (Default is False. DarkMode_DarkTheme is only available on Win11 26100.6899 and higher)
; Return values .: None
; Author ........: NoName
; Modified ......: WildByDesign
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _GUICtrlAllSetDarkTheme($hGUI, $bEnableDarkTheme = True, $bPreferNewTheme = False)
    Local $aCtrls = __WinAPI_EnumChildWindows($hGUI, False)
    For $i = 1 To $aCtrls[0][0]
        _GUICtrlSetDarkTheme($aCtrls[$i][0], $bEnableDarkTheme, $bPreferNewTheme)
    Next
    Local $aCtrlsEx = __WinAPI_EnumProcessWindows(0, False) ; allows getting handles for tooltips_class32, ComboLBox, etc.
    For $i = 1 To $aCtrlsEx[0][0]
        _GUICtrlSetDarkTheme($aCtrlsEx[$i][0], $bEnableDarkTheme, $bPreferNewTheme)
    Next
    Return $aCtrls
EndFunc


; #FUNCTION# ====================================================================================================================
; Name ..........: _GUICtrlSetDarkTheme
; Description ...: Sets the dark theme for a specified control.
; Syntax ........: _GUICtrlSetDarkTheme($vCtrl, $bEnableDarkTheme = True, $bPreferNewTheme = False)
; Parameters ....: $vCtrl            - The control handle or identifier.
;                  $bEnableDarkTheme - If True, enables the dark theme; if False, disables it.
;                                      (Default is True for enabling dark theme.)
;                  $bPreferNewTheme  - Prefer the newer DarkMode_DarkTheme theme over DarkMode_Explorer when possible.
;                                      (Default is False. DarkMode_DarkTheme is only available on Win11 26100.6899 and higher)
; Return values .: Success: True
;                  Failure: False and sets the @error flag:
;                           1: Invalid control handle or identifier.
;                           2: Error while allowing dark mode for the window.
;                           3: Error while setting the window theme.
;                           4: Error while sending the WM_THEMECHANGED message.
; Author ........: NoNameCode
; Modified ......: WildByDesign
; Remarks .......: This function requires the _WinAPI_SetWindowTheme and _WinAPI_AllowDarkModeForWindow functions.
; Related .......:
; Link ..........: http://www.opengate.at/blog/2021/08/dark-mode-win32/
; Example .......: Yes
; ===============================================================================================================================
Func _GUICtrlSetDarkTheme($vCtrl, $bEnableDarkTheme = True, $bPreferNewTheme = False)
    Local $sThemeName = Null, $sThemeList = Null
    Local $iGUI_Ctrl_Color = ($bEnableDarkTheme == True) ? $COLOR_TEXT_LIGHT : _WinAPI_SwitchColor(_WinAPI_GetSysColor($COLOR_WINDOWTEXT))
    Local $iGUI_Ctrl_BkColor = ($bEnableDarkTheme == True) ? $COLOR_CONTROL_BG : _WinAPI_SwitchColor(_WinAPI_GetSysColor($COLOR_BTNFACE))
    Local $bSpecialBtn = False, $bSpecialLV = False, $bSpecialTV = False
    Local $sStyles
    If Not IsHWnd($vCtrl) Then $vCtrl = GUICtrlGetHandle($vCtrl)
    If Not IsHWnd($vCtrl) Then Return SetError(1, 0, False)
    _WinAPI_AllowDarkModeForWindow($vCtrl, $bEnableDarkTheme)
    If @error <> 0 Then Return SetError(2, @error, False)
    ;=========
    ;ConsoleWrite(@CRLF & __WinAPI_GetClassName($vCtrl))
    Switch __WinAPI_GetClassName($vCtrl)
        Case 'Button'
            $sStyles = hWnd2Styles($vCtrl)
            Switch $bEnableDarkTheme
                Case True
                    If $bPreferNewTheme And $b24H2Plus Then
                        $sThemeName = 'DarkMode_DarkTheme'
                    Else
                        If StringInStr($sStyles, "BS_GROUPBOX") Or StringInStr($sStyles, "BS_AUTORADIOBUTTON") Then
                            $bSpecialBtn = True
                        Else
                            $sThemeName = 'DarkMode_Explorer'
                        EndIf
                    EndIf
                Case False
                    $sThemeName = 'Explorer'
            EndSwitch

        Case 'msctls_trackbar32'
            GUICtrlSetColor(_WinAPI_GetDlgCtrlID($vCtrl), $iGUI_Ctrl_Color)
            GUICtrlSetBkColor(_WinAPI_GetDlgCtrlID($vCtrl), $iGUI_Ctrl_BkColor)
            If $bEnableDarkTheme Then GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY")

        Case 'msctls_updown32'
            If $bEnableDarkTheme Then
                $sThemeName = 'DarkMode_Explorer'
                GUICtrlSetColor(_WinAPI_GetDlgCtrlID($vCtrl), $iGUI_Ctrl_Color)
                GUICtrlSetBkColor(_WinAPI_GetDlgCtrlID($vCtrl), $iGUI_Ctrl_BkColor)
            EndIf

        Case 'ListBox'
            Switch $bEnableDarkTheme
                Case True
                    If $bPreferNewTheme And $b24H2Plus Then
                        $sThemeName = 'DarkMode_DarkTheme'
                    Else
                        $sThemeName = 'DarkMode_Explorer'
                    EndIf

                    ; create brush and register GUI message
                    If Not $g_hBrushEdit Then $g_hBrushEdit = __WinAPI_CreateSolidBrush(_ColorToCOLORREF($COLOR_CONTROL_BG))
                    GUIRegisterMsg($WM_CTLCOLORLISTBOX, "_WM_CTLCOLOR")
                Case False
                    $sThemeName = 'Explorer'
            EndSwitch

        Case 'SysTreeView32'
            $sStyles = hWnd2Styles($vCtrl)
            Switch $bEnableDarkTheme
                Case True
                    If $bPreferNewTheme And $b24H2Plus Then
                        $sThemeName = 'DarkMode_DarkTheme'
                    Else
                        $sThemeName = 'DarkMode_Explorer'
                    EndIf

                    ; dark mode checkboxes
                    If StringInStr($sStyles, "TVS_CHECKBOXES") Then
                        $bSpecialTV = True
                    EndIf
                Case False
                    $sThemeName = 'Explorer'
            EndSwitch

            GUICtrlSetColor(_WinAPI_GetDlgCtrlID($vCtrl), $iGUI_Ctrl_Color)
            GUICtrlSetBkColor(_WinAPI_GetDlgCtrlID($vCtrl), $iGUI_Ctrl_BkColor)

        Case 'SysListView32'
            Switch $bEnableDarkTheme
                Case True
                    If $bPreferNewTheme And $b24H2Plus Then
                        $sThemeName = 'DarkMode_DarkTheme'
                    Else
                        $sThemeName = 'DarkMode_Explorer'
                    EndIf

                    ; register callback to subclass ListView header text color
                    $hWndListViewHeader = _GUICtrlListView_GetHeader($vCtrl)
                    $hWndListView = $vCtrl
                    $g__ListView_wProcNew = DllCallbackRegister("_LVWndProc", "ptr", "hwnd;uint;wparam;lparam")
                    $g__ListView_wProcOld = __WinAPI_SetWindowLong($vCtrl, $GWL_WNDPROC, DllCallbackGetPtr($g__ListView_wProcNew))

                    ; checkbox dark mode
                    If (BitAND(_GUICtrlListView_GetExtendedListViewStyle($vCtrl), $LVS_EX_CHECKBOXES) = $LVS_EX_CHECKBOXES) Then
                        $bSpecialLV = True
                    EndIf
                Case False
                    $sThemeName = 'Explorer'
            EndSwitch

            GUICtrlSetColor(_WinAPI_GetDlgCtrlID($vCtrl), $iGUI_Ctrl_Color)
            GUICtrlSetBkColor(_WinAPI_GetDlgCtrlID($vCtrl), $iGUI_Ctrl_BkColor)

        Case 'Edit'
            Switch $bEnableDarkTheme
                Case True
                    If $bPreferNewTheme And $b24H2Plus Then
                        $sThemeName = 'DarkMode_DarkTheme'
                    Else
                        $sThemeName = 'DarkMode_Explorer'
                    EndIf

                    ; create brush and register GUI message
                    If Not $g_hBrushEdit Then $g_hBrushEdit = __WinAPI_CreateSolidBrush(_ColorToCOLORREF($COLOR_CONTROL_BG))
                    GUIRegisterMsg($WM_CTLCOLOREDIT, "_WM_CTLCOLOR")
                Case False
                    $sThemeName = 'Explorer'
            EndSwitch

        Case 'SysHeader32'
            Switch $bEnableDarkTheme
                Case True
                    If $bPreferNewTheme And $b24H2Plus Then
                        $sThemeName = 'DarkMode_DarkTheme'
                    Else
                        $sThemeName = 'DarkMode_ItemsView'
                    EndIf
                Case False
                    $sThemeName = 'ItemsView'
            EndSwitch
            $sThemeList = 'Header'

        Case 'Static'
            If $bEnableDarkTheme Then
                GUICtrlSetColor(_WinAPI_GetDlgCtrlID($vCtrl), $iGUI_Ctrl_Color)
            EndIf

        Case 'SysDateTimePick32'
            ; if SysDateTimePick32 exists, obtain handle for SysDateTimePick32 and register WM_NOTIFY
            If $bEnableDarkTheme Then
                $g_hDate = $vCtrl
                $g_hDateProc_CB = DllCallbackRegister('_DateProc', 'ptr', 'hwnd;uint;wparam;lparam')
                $g_pDateProc_CB = DllCallbackGetPtr($g_hDateProc_CB)
                $g_hDateOldProc = __WinAPI_SetWindowLong($g_hDate, $GWL_WNDPROC, $g_pDateProc_CB)
                GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY")
            EndIf

        Case 'msctls_progress32'
            If $bEnableDarkTheme Then
                If $bPreferNewTheme And $b24H2Plus Then
                    $sThemeName = 'DarkMode_CopyEngine'
                Else
                    $sThemeName = 'DarkMode'
                EndIf
                $sThemeList = 'Progress'
            EndIf

        Case 'Scrollbar'
            If $bEnableDarkTheme Then $sThemeName = 'DarkMode_Explorer'

        Case 'AutoIt v3 GUI'
            If $bEnableDarkTheme Then $sThemeName = 'DarkMode_Explorer'

        Case 'msctls_statusbar32'
            If $bEnableDarkTheme Then
                If $bPreferNewTheme And $b24H2Plus Then
                    $sThemeName = 'DarkMode_DarkTheme'
                    $sThemeList = 'Status'
                Else
                    $sThemeName = 'DarkMode'
                    $sThemeList = 'ExplorerStatusBar'
                EndIf
            Else
                ;
            EndIf

        Case 'tooltips_class32'
            If $bEnableDarkTheme Then
                If $bPreferNewTheme And $b24H2Plus Then
                    ;$sThemeName = 'DarkMode_DarkTheme' ; works but is faded (MS still developing DarkMode_DarkTheme parts)
                    $sThemeName = 'DarkMode_Explorer' ; use for now
                    $sThemeList = 'ToolTip'
                Else
                    $sThemeName = 'DarkMode_Explorer'
                    $sThemeList = 'ToolTip'
                EndIf
            Else
                ;
            EndIf

        Case 'ComboLBox', 'ComboBox'
            If $bEnableDarkTheme Then
                If $bPreferNewTheme And $b24H2Plus Then
                    $sThemeName = 'DarkMode_DarkTheme'
                    $sThemeList = 'Combobox'
                Else
                    $sThemeName = 'DarkMode_CFD'
                    $sThemeList = 'Combobox'
                EndIf

                ; create brush and register GUI message
                If Not $g_hBrushEdit Then $g_hBrushEdit = __WinAPI_CreateSolidBrush(_ColorToCOLORREF($COLOR_CONTROL_BG))
                GUIRegisterMsg($WM_CTLCOLORLISTBOX, "_WM_CTLCOLOR")
            Else
                ;
            EndIf

            GUICtrlSetColor(_WinAPI_GetDlgCtrlID($vCtrl), $iGUI_Ctrl_Color)
            GUICtrlSetBkColor(_WinAPI_GetDlgCtrlID($vCtrl), $iGUI_Ctrl_BkColor)

            #cs
            Local $hEdit = _WinAPI_FindWindowEx($vCtrl, 0, "Edit", "")
            If $hEdit Then
                __WinAPI_SetWindowTheme($hEdit, "DarkMode_CFD", 0)
                 _WinAPI_AllowDarkModeForWindow($hEdit, True)
            EndIf
            ; ComboBox dropdown list
            Local $hComboLBox = _WinAPI_FindWindowEx($vCtrl, 0, "ComboLBox", "")
            If $hComboLBox Then
                __WinAPI_SetWindowTheme($hComboLBox, "DarkMode_Explorer", 0)
                _WinAPI_AllowDarkModeForWindow($hComboLBox, True)
            EndIf
            #ce

        Case 'SysTabControl32'
            If $bEnableDarkTheme Then
                If $bPreferNewTheme And $b24H2Plus Then
                    $sThemeName = 'DarkMode_DarkTheme'
                    $sThemeList = 'Tab'
                Else
                    $sThemeName = 'DarkMode_Explorer'
                    ; Register a custom window procedure for the tab control for owner-drawing
                EndIf

                ; Register a custom window procedure for the tab control for owner-drawing
                $g_hTab_CB = DllCallbackRegister('_WinProc', 'ptr', 'hwnd;uint;wparam;lparam')
                $g_pTab_CB = DllCallbackGetPtr($g_hTab_CB)
                $g_hProc = __WinAPI_SetWindowLong($vCtrl, $GWL_WNDPROC, $g_pTab_CB)
                $g_hTab = $vCtrl
            Else
                $sThemeName = 'Explorer'
            EndIf

        Case Else
            $sThemeName = 'Explorer'

    EndSwitch
    ;ConsoleWrite(@CRLF & 'Class:' & __WinAPI_GetClassName($vCtrl) & ' Theme:' & $sThemeName & '::' & $sThemeList)
    ;=========
    __WinAPI_SetWindowTheme($vCtrl, $sThemeName, $sThemeList)
    If @error <> 0 Then Return SetError(3, @error, False)
    __SendMessage($vCtrl, $WM_THEMECHANGED, 0, 0)
    If @error <> 0 Then Return SetError(4, @error, False)
    If $bSpecialBtn Then
        ; this is used to remove theme from group box and radio buttons which are not themed properly with older DarkMode_Explorer
        __WinAPI_SetWindowTheme($vCtrl, "", "")
        GUICtrlSetColor(_WinAPI_GetDlgCtrlID($vCtrl), $iGUI_Ctrl_Color)
    EndIf
    _GDIPlus_Startup()
    Local Static $hIcon_c, $hIcon_uc
    Local $hBmp
    If $hIcon_c = 0 Then 
        $hBmp = _GDIPlus_BitmapCreateFromMemory(_checkedico())
        $hIcon_c = _GDIPlus_HICONCreateFromBitmap($hBmp)
        _GDIPlus_ImageDispose($hBmp)
    EndIf
    If $hIcon_uc = 0 Then
        $hBmp = _GDIPlus_BitmapCreateFromMemory(_uncheckedico())
        $hIcon_uc = _GDIPlus_HICONCreateFromBitmap($hBmp)
        _GDIPlus_ImageDispose($hBmp)
    EndIf
    If $bSpecialLV Then
        Local $hImageListLV = _GUICtrlListView_GetImageList($vCtrl, 2)
        _GUIImageList_Remove($hImageListLV)
        _GUIImageList_ReplaceIcon($hImageListLV, -1, $hIcon_uc)
        _GUIImageList_ReplaceIcon($hImageListLV, -1, $hIcon_c)
    EndIf
    If $bSpecialTV Then
        Local $hImageListTV = _GUICtrlTreeView_GetStateImageList($vCtrl)
        _GUIImageList_Remove($hImageListTV)
        _GUIImageList_ReplaceIcon($hImageListTV, -1, $hIcon_c)
        _GUIImageList_ReplaceIcon($hImageListTV, -1, $hIcon_c)
        _GUIImageList_ReplaceIcon($hImageListTV, -1, $hIcon_uc)
    EndIf
    _GDIPlus_Shutdown()
    Return True
EndFunc   ;==>_GUICtrlSetDarkTheme

#EndRegion Public Functions

#Region Enable GUI DARKMODE

; TODO: these functions probably need common #FUNCTION# to be more descriptive
Func _ApplyDarkTheme($hGUI, $bPreferNewTheme = False)
    _GUISetDarkTheme($hGUI, True)
    _GUICtrlAllSetDarkTheme($hGUI, True, $bPreferNewTheme)

    ; GUIDarkMenu
    _GUITopMenuTheme($hGUI)
    ; redraw menus
    _GUICtrlMenu_DrawMenuBar($hGUI)
EndFunc

#EndRegion Enable GUI DARKMODE

#Region Enable GUI LIGHTMODE

Func _ApplyLightTheme($hGUI)
    _GUISetDarkTheme($hGUI, False)
    _GUICtrlAllSetDarkTheme($hGUI, False)
EndFunc

#EndRegion Enable GUI LIGHTMODE

;Code below was generated by: 'File to Base64 String' Code Generator v1.20 Build 2020-06-05

Func _uncheckedico($bSaveBinary = False, $sSavePath = @ScriptDir)
    Local $uncheckedico
    $uncheckedico &= 'JLgAAAABAAcADQ2iAAAACADhAFB2ABgEEBADeA0BAABXKQAMFBQDPBYALGQCUAAAGhoDPBkAPHqgAwAAICADHiIAHkCTBAAAKCgDHgyBAFa1BQAANDQDHgIlAB7BBwAAiVBATkcNChoKACgNMElIRFIBBwEDCAYhAAVy6+R8AAYJcIBIWXMAAA7DAQMgAcdvqGQAFBl0AEVYdFNvZnR3AGFyZQB3d3cuAGlua3NjYXBlgC5vcmeb7jwBmABuSURBVCiR7QDOsQ2DQBQDUAD7xBZJdXOQAQBQekZgJpIBMgBKtjjfSTCHPwADpOA6mlhy5wAnmaWUJ4AXyQAbzrOnlJaB5ABqe845f8+EpADR9geSIiLQWwBJkTou/eSPLgBBu6SxZ1xrfQAA2Nham2y/AQDcO9xGcjkAKYDDR/wtaZg+AXEASUVORK5CYIILEHABqRACcB/z/2EFOnCaAXA4je2TuwANwkAQBed8yADWBdRA7h4QOQBtIDpwN+BSkACQi9jotEWQ+ACTPBJMRGATewCkDd9sNMHdDwBACxyBkmVMQAAn6bIDWkmPYQAYznVdT0vWZgBWppSaEMI9uAD72Pf9ful4JgDnXMUYX7i7JADxz7m7ijVffwCxCTbBLJjMbABpRF9yzhUwFgBAl1Jq1kjMrACMMTZAFz453wCAE+tyfkq6vgAB5PhpkG9/YxbrHEPBkxQCQ42JHQuBf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jAGHPa6XSuAOoUjcfj1SzLAHZF5ADoACNrAO1ONJvN9kXkADMwT9N0Wyn1ALNO2MPKsly3ANZ+AzaAfiwiAD0AERk0jQNoALfbv4Che/ZiAOANgDHmtDHVAIOstSfu3IyBABcAdX9zT5XnAPlvd67GjUqeAFEA+haAvgWgEG8B6FtWAQPXsADc5xq23DWdTgBfuvMqBi4BsgAs222O9G9RFAC9'
    $uncheckedico &= 'c+ePGPgCIAAiB2VZrjfHWgBWVdUr4JN7HgD9nYDPgW1gDgAMrbUn9yawWgAqimItSZL3DgCngJHWunt/RAA/dsj/obsRPQIGwB5a6y7QB84AcT9OzV0DZ0AAX2vdVUpVAH8AAOQTmFcI9KgW1HxBge00YkHFeBsvIbF/Qb8gsyCysSBogQDt2rFqFFEUgADhf2Z2mEKjBABLr1sNLETBdABrn0ILn8A8gADVCiEvkcbC1gDavIEWyQsYuwAVVFh22IXZnQDWQBK5yOVyLAB2DKkCbpA5gQDzVed25y9mqgCTiAgAVVUVvQBe77WIvAKeAAB30O0X8A04jAAxvi/L8jdAIgAiLJfLhyGETwDA005XXN84zwDzl865JplOpwBFlmVfWMUsRABkL4RwPBgMzgC73vI6k8lkowAoih0ROQAGwAA4xvgsmc/nbwBE5B2wyPN82wA597PjXf9JXQDXmzHGr8AjYACUisgugIjs3QC2GIB+v38K7AC3z90U2AIIIQAcd7bVDcUYjwDa8XEK3AXQ/gDNXKcsy7N23ABIO93kP7Ag7QAsSDsL0s6CtA6zrwCvAKEALgUuYAB1O9PxLmubzQBm99vxPAV+AAAURbHT3Uo3kwAkyfN2/J4CHwAAROSgruvN7gDWWk/TNA+AtwDt8/DvedkJsAANLID9GOPRlQBzE5WqqrqXZQDZC1YxDhh77wCHVw8AP7KKugCNLg8AUwDnXADjvR8CI+CE9gBHodwF8BkYeQDvh865BuAPs4CEmG/rOy7qSSI='
    $uncheckedico = _WinAPI_Base64Decode($uncheckedico)
    If @error Then Return SetError(1, 0, 0)
    Local $tSource = DllStructCreate('byte[' & BinaryLen($uncheckedico) & ']')
    DllStructSetData($tSource, 1, $uncheckedico)
    Local $tDecompress
    _WinAPI_LZNTDecompress($tSource, $tDecompress, 2534)
    If @error Then Return SetError(3, 0, 0)
    $tSource = 0
    Local Const $bString = Binary(DllStructGetData($tDecompress, 1))
    If $bSaveBinary Then
        Local Const $hFile = FileOpen($sSavePath & "\unchecked.ico", 18)
        If @error Then Return SetError(2, 0, $bString)
        FileWrite($hFile, $bString)
        FileClose($hFile)
    EndIf
    Return $bString
EndFunc   ;==>_uncheckedico

Func _checkedico($bSaveBinary = False, $sSavePath = @ScriptDir)
    Local $checkedico
    $checkedico &= 'FrwAAAABAAcADQ0CAAAACABoAQAAUnYASBAQA3icAHjeKQAMFBQDPLMALHoDUAAAGhoDPOoAPC0gBQAAICADHgUCAAAAFwcAACgoBQMeLAAeHAkAADQKNAMe7wAeSAsAAACJUE5HDQoaCsEAKA1JSERSAQcBA4QIBgAFcuvkfAAGAAFzUkdCAdnJBCx/AAwEZ0FNQYAAALGPC/xhAG9AACBjSFJNAIsmgAAAgIQAAPoAEgCA6AAAdTAAAEDqYAAAOpgAh3AQnLpRPAAYCXBIQFlzAAASdAEDARDeZh94ABQHdEkATUUH6QUDFScQC3AwyoBLAL5JAERBVCjPlZI9AArCUBCEv32IAJ2Q0lbIAQT1AAD2eoY8K8vgAAmMJzBHeAewABC8gIWluYGVABcwkC5F1sJGAGN+t5thPwZ2AFYAgkQjUQ0RAPGoG9UUwbmZANlJkBSxICFdAEc1EnsvXo0JABWJphcAIOKZAC57j4v70a3QAG1vQaQeel7PAH/AeLHEXwX1AFCepdyiTSMAADD4Fv7aAnBaAE+YbqNKAEBsAKJaNvMsZTiqAD+qQTUtm03AAKcniPv1hBMAAJsURxTb+nsQALu5ObwBAjdAINLNNQjVgbRJRcBORK5CYIKQs4HsQhCCsx/z/2HosyagLbsmfr6ABPLBWQA4y6WSoU4DQQAQhr/ZENSRNAC4Vi0JCfaa0AAHwNX0AVA9TADtlSegj3CV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gF4Yj+ABGI/lQmB03EADPeGvig+Z/lQAi7Xrr0jcAagBkK9fFQTXU'
    $checkedico &= 'gQDs3JRtb0UCZQA4kE8Q29dtZgA395D3TDqq5ABrpVTD0U6sYQBdGMtVA+A+SAAz4xhfL2RrvAABUG6bP2xqUgAHxYaMtGhCgADgi9BtPzVfJgBN+wPXaGWGHAihNfHpLg=='
    $checkedico = _WinAPI_Base64Decode($checkedico)
    If @error Then Return SetError(1, 0, 0)
    Local $tSource = DllStructCreate('byte[' & BinaryLen($checkedico) & ']')
    DllStructSetData($tSource, 1, $checkedico)
    Local $tDecompress
    _WinAPI_LZNTDecompress($tSource, $tDecompress, 3639)
    If @error Then Return SetError(3, 0, 0)
    $tSource = 0
    Local Const $bString = Binary(DllStructGetData($tDecompress, 1))
    If $bSaveBinary Then
        Local Const $hFile = FileOpen($sSavePath & "\checked.ico", 18)
        If @error Then Return SetError(2, 0, $bString)
        FileWrite($hFile, $bString)
        FileClose($hFile)
    EndIf
    Return $bString
EndFunc   ;==>_checkedico

Func _WinAPI_Base64Decode($sB64String)
    Local $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0)
    If @error Or Not $aCrypt[0] Then Return SetError(1, 0, "")
    Local $bBuffer = DllStructCreate("byte[" & $aCrypt[5] & "]")
    $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "struct*", $bBuffer, "dword*", $aCrypt[5], "ptr", 0, "ptr", 0)
    If @error Or Not $aCrypt[0] Then Return SetError(2, 0, "")
    Return DllStructGetData($bBuffer, 1)
EndFunc   ;==>_WinAPI_Base64Decode

Func _WinAPI_LZNTDecompress(ByRef $tInput, ByRef $tOutput, $iBufferSize)
    $tOutput = DllStructCreate("byte[" & $iBufferSize & "]")
    If @error Then Return SetError(1, 0, 0)
    Local $aRet = DllCall("ntdll.dll", "uint", "RtlDecompressBuffer", "ushort", 0x0002, "struct*", $tOutput, "ulong", $iBufferSize, "struct*", $tInput, "ulong", DllStructGetSize($tInput), "ulong*", 0)
    If @error Then Return SetError(2, 0, 0)
    If $aRet[0] Then Return SetError(3, $aRet[0], 0)
    Return $aRet[6]
EndFunc   ;==>_WinAPI_LZNTDecompress

For sure you can use GD+ to draw the check / uncheck icons (bitmaps) as @argumentum did above.

Edited by UEZ

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted

@argumentum I just wanted to state the obvious: You do DPI better than Microsoft does! :thumbsup:

 

12 minutes ago, UEZ said:

GUIDarkTheme.au3 incl. base64 icons:

This gives me a lot to learn from, I appreciate it. I've already tested it and it works great, but I'm going to go over the code as well because I want to learn more of the techniques. Thank you.

You are a genius, by the way. :)

Posted (edited)

I updated also my example by drawing the checkbox using GDI+ with aa. It uses GDI and GDIPlus to create it -> see _SetDarkTreeViewCheckboxes() function.

Next step is to add DPI using _WinAPI_DPI.au3 from here:

 

Let's see how complicated it will be to draw all the controls on DPI changes...

Edited by UEZ

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted

@UEZ I apologize, but I think I need your help with the Base64 code. I am trying to switch your ICO code to load PNG instead. I have realized that AutoIt (or Windows) loads the incorrect DPI size from the ICO file, whereas from PNG it is sharp.

The Base64 that I have in here is from PNG. I think my problem is in this area:

$hBmp = _GDIPlus_BitmapCreateFromMemory(_checkedpng(), True)
        ;$hIcon_c = _GDIPlus_HICONCreateFromBitmap($hBmp)
        $hIcon_c = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp)
        _GDIPlus_ImageDispose($hBmp)

If you can get that PNG to load for the checked/unchecked state, I can do the rest of the DPI stuff. I will do a Switch Case for all of the Base64 from original msstyles resources.

For example, here is all of the Base64 DPI sizes for checked and most for unchecked (I still have to get the rest of unchecked):

Local $checked96
$checked96 &= 'iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAYAAABy6+R8AAAAAXNSR0IB2cksfwAAAARnQU1BAACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAAOwwAADsMBx2+oZAAAAAd0SU1FB+oDAxcYOepp4t4AAADpSURBVCjPY2RgYGAwSG9o0IrMz2fjFRBgwAF+ff7w4c7mBQtO9RYWMpuVTJigm1BezszOwcGABzCzc3CI6lpYMDAwMDBGHXj/Hp8N2GxkIkUDAwMDAxuvgAATMQrvbF6Awieo6Uh9AgMDIyNuTY8ObMDQIGHqyKDiE49b06/PHxiONCTi1cDAwMDAgsxR8U1gYGBgYFjjq8hgkN6AVQMDAwMDY8LZ//+xBCsDGy/uQGX69fnDByzBijeemJnZODgkTBwciI2nm2tnzGB+cfbgQTZeAQF+BQ0NfEnp1+cPHy4v6Og4O6WyEgBYG0pIgbNupgAAAABJRU5ErkJggg=='

Local $checked120
$checked120 &= 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IB2cksfwAAAARnQU1BAACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAAOwwAADsMBx2+oZAAAAAd0SU1FB+oDAxcZFLatj+oAAAEPSURBVDjLY2RgYGDQiioo0IrKz+eRVFBgIAK8u3XhwrWlEybc2bJwIaOKb0KCTcP8+QxkgFO9hYWMfsvPnxdSMzAgx4Avzx48YEw4+/8/AwWAiYFCQJIBdzYvYPj1+QN5BlyY2cBwbdlEBjZeAdINuDCzgeHRg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k4/+CAAAAAElFTkSuQmCC'

 

GUIDarkTheme.au3

Posted

GUIDarkTheme 0.9.1:

  • Using PNG resources instead of ICO
    • Sharp ListView/TreeView checkbox images
    • ICO was incorrectly loading the wrong icon size per DPI
  • Fixed issue with TreeView ImageList incorrect order

This release fixes the sharpness of the ListView/TreeView checkboxes and also the incorrect order of the TreeView ImageList.

Ideally, I would like to switch to using Base64 for these same PNG images so that we can have maximum sharpness and also so that the checkboxes match the checkbox of the regular checkbox 100%. But I am stuck on the Base64 part.

GUIDarkTheme-0.9.1.7z

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...