-
Posts
7,459 -
Joined
-
Last visited
-
Days Won
94
UEZ last won the day on February 27
UEZ had the most liked content!
About UEZ

- Birthday 12/03/2007
Profile Information
-
Member Title
Never say never
-
Location
Germany
-
Interests
Computer, watching movies, football (soccer), being lazy :-)
UEZ's Achievements
-
ioa747 reacted to a post in a topic:
SampleControls.au3 in Dark Mode
-
MattyD reacted to a post in a topic:
SampleControls.au3 in Dark Mode
-
_GDIPlus_BitmapApplyFilter v1.0.5 build 2026-03-16 beta
UEZ replied to UEZ's topic in AutoIt Example Scripts
Many new filters added and made some speed improvement. See post#1 for details and image gallery. -
WildByDesign reacted to a post in a topic:
SampleControls.au3 in Dark Mode
-
I did some modifications -> It gets more and more complicated and I'm loosing the overview of all stuff.... Very good - seems to be more stable and the behaviour is same as MsgBox() - thanks.
-
UEZ reacted to a post in a topic:
SampleControls.au3 in Dark Mode
-
Very good. You may add an entry to the tray menu to reset the position of the clock for the case it is out of the screen on next startup.
-
UEZ reacted to a post in a topic:
DesktopClock
-
Thanks for the hint @MattyD - it fixed the focus crash. This seems to work - please test: ;Coded by UEZ build 2026-03-19 beta #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so #Au3Stripper_Ignore_Funcs=_TimerProc #include <ButtonConstants.au3> #include <Timers.au3> #include <WinAPIConstants.au3> #include <WinAPIGdi.au3> #include <WinAPIProc.au3> #include <WinAPISys.au3> #include <WinAPISysWin.au3> #include <WinAPITheme.au3> #include <WindowsConstants.au3> Global Const $BS_PUSHBUTTON = 0x000000 Global Const $COLOR_BG_DARK = 0x202020 Global Const $COLOR_TEXT_LIGHT = 0xF0F0F0 Global Const $COLOR_HOTTRACK_MENU = 0x3A3A3A Global Const $COLOR_TITLE_DARK = 0x181818 Const $HCBT_CREATEWND = 3, $HCBT_DESTROYWND = 4, $HCBT_ACTIVATE = 5, $g_iFlagDefault = BitOR($MB_TOPMOST, $MB_ICONINFORMATION) Global $g_hMsgBoxHook, $g_hSubMsgBox, $g_idTImer, $g_sBtn1_Txt = "Close", $g_sBtn2_Txt, $g_sBtn3_Txt Global $g_Timeout = 0, $g_hMsgBoxOldProc, $g_hMsgBoxBrush, $g_hMsgBoxBtn = 0, $g_bMsgBoxClosing = False, $g_bNCLButtonDown = False, $g_bMsgBoxInitialized = False Global $g_hMsgBoxSubProc = DllCallbackRegister("_MsgBoxProc", "lresult", "hwnd;uint;wparam;lparam") Func _WinAPI_SetDlgItemText($hDlg, $nIDDlgItem, $lpString) ;https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setdlgitemtextw Local $aRet = DllCall("user32.dll", "int", "SetDlgItemText", "hwnd", $hDlg, "int", $nIDDlgItem, "str", $lpString) If @error Then Return SetError(@error, @extended, 0) Return $aRet[0] EndFunc ;==>_WinAPI_SetDlgItemText Func _WinAPI_FindWindowEx($hParent, $sClass, $sTitle = "", $hAfter = 0) Local $ret = DllCall("user32.dll", "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 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 Func _MsgBoxProc($hWnd, $iMsg, $wParam, $lParam) If Not $g_hMsgBoxOldProc Then Return _WinAPI_DefWindowProc($hWnd, $iMsg, $wParam, $lParam) If $g_Timeout < 0 Or Not _WinAPI_IsWindow($hWnd) Then Return _WinAPI_DefWindowProc($hWnd, $iMsg, $wParam, $lParam) Switch $iMsg Case $WM_CTLCOLORSTATIC, $WM_CTLCOLORDLG, $WM_CTLCOLORBTN If Not $g_hMsgBoxBrush Then Return _WinAPI_CallWindowProc($g_hMsgBoxOldProc, $hWnd, $iMsg, $wParam, $lParam) _WinAPI_SetTextColor($wParam, _ColorToCOLORREF($COLOR_TEXT_LIGHT)) _WinAPI_SetBkColor($wParam, _ColorToCOLORREF($COLOR_BG_DARK)) Return $g_hMsgBoxBrush Case $WM_ERASEBKGND If Not $g_hMsgBoxBrush Then Return _WinAPI_CallWindowProc($g_hMsgBoxOldProc, $hWnd, $iMsg, $wParam, $lParam) Local $tRECT = _WinAPI_GetClientRect($hWnd) _WinAPI_FillRect($wParam, $tRECT, $g_hMsgBoxBrush) Return 1 Case $WM_PAINT Local $iRet = _WinAPI_CallWindowProc($g_hMsgBoxOldProc, $hWnd, $iMsg, $wParam, $lParam) Local $hDC = _WinAPI_GetDC($hWnd) Local $tRECT = _WinAPI_GetClientRect($hWnd) If $g_hMsgBoxBtn Then Local $tBtnRect = _WinAPI_GetWindowRect($g_hMsgBoxBtn) Local $tPoint = DllStructCreate($tagPOINT) $tPoint.x = $tBtnRect.left $tPoint.y = $tBtnRect.top _WinAPI_ScreenToClient($hWnd, $tPoint) $tRECT.top = $tPoint.y - 10 EndIf Local $hBrushFooter = _WinAPI_CreateSolidBrush(_ColorToCOLORREF($COLOR_HOTTRACK_MENU)) _WinAPI_FillRect($hDC, $tRECT, $hBrushFooter) _WinAPI_ReleaseDC($hWnd, $hDC) _WinAPI_DeleteObject($hBrushFooter) Return $iRet Case $WM_COMMAND If $g_bNCLButtonDown And (BitAND($wParam, 0xFFFF) = $IDOK) Then $g_bMsgBoxClosing = True Return 0 EndIf Return _WinAPI_CallWindowProc($g_hMsgBoxOldProc, $hWnd, $iMsg, $wParam, $lParam) Case $WM_NCLBUTTONDOWN $g_bNCLButtonDown = True Local $iRet = _WinAPI_CallWindowProc($g_hMsgBoxOldProc, $hWnd, $iMsg, $wParam, $lParam) $g_bNCLButtonDown = False If $g_bMsgBoxClosing Then _WinAPI_PostMessage($hWnd, $WM_COMMAND, $IDOK + 1, 0) EndIf Return $iRet Case $WM_CLOSE If $g_idTImer Then _Timer_KillTimer($hWnd, $g_idTImer) $g_idTImer = 0 EndIf Case $WM_NCDESTROY _WinAPI_SetWindowLong($hWnd, $GWL_WNDPROC, $g_hMsgBoxOldProc) Local $hBrush = $g_hMsgBoxBrush $g_hMsgBoxBrush = 0 If $hBrush Then _WinAPI_DeleteObject($hBrush) EndIf Case $WM_DESTROY If $g_idTImer Then _Timer_KillTimer($hWnd, $g_idTImer) $g_idTImer = 0 EndIf Return _WinAPI_CallWindowProc($g_hMsgBoxOldProc, $hWnd, $iMsg, $wParam, $lParam) EndSwitch Return _WinAPI_CallWindowProc($g_hMsgBoxOldProc, $hWnd, $iMsg, $wParam, $lParam) EndFunc Func _TimerProc($hWnd, $iMsg, $wParam, $lParam) If Not _WinAPI_IsWindow($hWnd) Or $g_bMsgBoxClosing Then Return If $g_Timeout <= 1 Then $g_bMsgBoxClosing = True _Timer_KillTimer($hWnd, $g_idTImer) $g_idTImer = 0 If Not $g_bNCLButtonDown Then _WinAPI_PostMessage($hWnd, $WM_COMMAND, $IDOK + 1, 0) Return EndIf $g_Timeout -= 1 _WinAPI_SetDlgItemText($hWnd, $IDOK + 1, $g_sBtn1_Txt & " [" & $g_Timeout & "]") EndFunc Func _CBTHookProc($nCode, $wParam, $lParam) If $nCode < 0 Then Return _WinAPI_CallNextHookEx($g_hMsgBoxHook, $nCode, $wParam, $lParam) Local Const $hHWND = HWnd($wParam) Switch $nCode Case $HCBT_ACTIVATE If _WinAPI_GetClassName($hHWND) = "#32770" Then If $g_bMsgBoxInitialized Then Return _WinAPI_CallNextHookEx($g_hMsgBoxHook, $nCode, $wParam, $lParam) $g_bMsgBoxInitialized = True If $g_Timeout Then $g_idTImer = _Timer_SetTimer($hHWND, 1000, "_TimerProc") _WinAPI_SetDlgItemText($wParam, $IDOK, $g_Timeout ? $g_sBtn1_Txt & " [" & $g_Timeout & "]" : $g_sBtn1_Txt) ; Title bar dark _WinAPI_DwmSetWindowAttribute($hHWND, $DWMWA_USE_IMMERSIVE_DARK_MODE, True) ; Dark title + caption colors _WinAPI_DwmSetWindowAttribute($hHWND, 20, True) ; immersive dark ; optional: remove bright border _WinAPI_DwmSetWindowAttribute($hHWND, $DWMWA_BORDER_COLOR, _ColorToCOLORREF(0x303030)) ; caption color _WinAPI_DwmSetWindowAttribute($hHWND, $DWMWA_CAPTION_COLOR, _ColorToCOLORREF($COLOR_TITLE_DARK)) ; caption text _WinAPI_DwmSetWindowAttribute($hHWND, $DWMWA_TEXT_COLOR, _ColorToCOLORREF($COLOR_TEXT_LIGHT)) Local $i, $iStyle For $i = 0 To 7 $hBtn = _WinAPI_GetDlgItem($hHWND, $i) If $hBtn Then $g_hMsgBoxBtn = $hBtn _WinAPI_SetWindowTheme($hBtn, "DarkMode_Explorer", 0) _WinAPI_AllowDarkModeForWindow($hBtn, True) EndIf Next ; Dark theme for static controls (text + icon) Local $hStatic = _WinAPI_FindWindowEx($hHWND, "Static") While $hStatic _WinAPI_AllowDarkModeForWindow($hStatic, True) $hStatic = _WinAPI_FindWindowEx($hHWND, "Static", "", $hStatic) WEnd $g_hMsgBoxBrush = _WinAPI_CreateSolidBrush(_ColorToCOLORREF($COLOR_BG_DARK)) $g_hMsgBoxOldProc = _WinAPI_SetWindowLong($hHWND, $GWL_WNDPROC, DllCallbackGetPtr($g_hMsgBoxSubProc)) _WinAPI_RedrawWindow($hHWND, 0, 0, BitOR($RDW_INVALIDATE, $RDW_UPDATENOW, $RDW_ALLCHILDREN)) EndIf Case $HCBT_DESTROYWND If _WinAPI_GetClassName($hHWND) = "#32770" Then $g_bMsgBoxInitialized = False _Timer_KillTimer($hHWND, $g_idTImer) EndIf EndSwitch Return _WinAPI_CallNextHookEx($g_hMsgBoxHook, $nCode, $wParam, $lParam) EndFunc ;==>_CBTHookProc Func MsgBoxEx($sText, $sTitle = Default, $iTimeout = 0, $iFlag = Default, $sBtn_Txt = Default, $hParentHWND = "") $g_hMsgBoxBtn = 0 $g_bMsgBoxClosing = False $g_bNCLButtonDown = False $g_bMsgBoxInitialized = False If $sBtn_Txt <> Default Then $g_sBtn1_Txt = $sBtn_Txt If $iFlag = Default Then $iFlag = $g_iFlagDefault $g_Timeout = $iTimeout Local $hMsgProc = DllCallbackRegister("_CBTHookProc", "int", "uint;wparam;lparam") Local Const $hThreadID = _WinAPI_GetCurrentThreadId() $g_hMsgBoxHook = _WinAPI_SetWindowsHookEx($WH_CBT, DllCallbackGetPtr($hMsgProc), Null, $hThreadID) If $sTitle = Default Then $sTitle = "Information" Local Const $iReturn = MsgBox($iFlag, $sTitle, $sText, 0, $hParentHWND) If $g_hMsgBoxHook Then _WinAPI_UnhookWindowsHookEx($g_hMsgBoxHook) DllCallbackFree($hMsgProc) Return $iReturn EndFunc ;==>MsgBoxEx Func _WinAPI_AllowDarkModeForWindow($hWND, $bAllow = True) Local $aResult = DllCall("UxTheme.dll", "bool", 133, "hwnd", $hWND, "bool", $bAllow) If @error Then Return SetError(1, 0, False) Return ($aResult[0] <> 0) EndFunc ;==>_WinAPI_AllowDarkModeForWindow ConsoleWrite(MsgBoxEx("This is a test", "Information", 5) & @CRLF)
-
WildByDesign reacted to a post in a topic:
SampleControls.au3 in Dark Mode
-
Yes. 👍
-
1) disadvantage of this technigue is always the aa quality and with the other technigue you can achive better quality 2) _StringTitleCase() works properly 3) yes, but when I think about it, there will always be a situation where even this doesn't work propely 4) that was new to me, too. 😄
-
Nice idea - added to DPI code. I've a MsgBox in the example when you select About in the menus which is not in dark mode. I created a MsgBoxEx to make also the Windows MsgBox dark. One issue is when you added timer to the MsgBoxEx and drag it around when counter reaches 0 and the MsgBox is closed it will cause a crash -> 0xC000041D It is more or less this code: ;Coded by UEZ build 2026-03-19 beta #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so #Au3Stripper_Ignore_Funcs=_TimerProc #include <ButtonConstants.au3> #include <Timers.au3> #include <WinAPIConstants.au3> #include <WinAPIGdi.au3> #include <WinAPIProc.au3> #include <WinAPISys.au3> #include <WinAPISysWin.au3> #include <WinAPITheme.au3> #include <WindowsConstants.au3> Global Const $BS_PUSHBUTTON = 0x000000 Global Const $COLOR_BG_DARK = 0x202020 Global Const $COLOR_TEXT_LIGHT = 0xF0F0F0 Global Const $COLOR_HOTTRACK_MENU = 0x3A3A3A Const $HCBT_CREATEWND = 3, $HCBT_DESTROYWND = 4, $HCBT_ACTIVATE = 5, $g_iFlagDefault = BitOR($MB_TOPMOST, $MB_ICONINFORMATION) Global $g_hMsgBoxHook, $g_hSubMsgBox, $g_idTImer, $g_sBtn1_Txt = "Close", $g_sBtn2_Txt, $g_sBtn3_Txt Global $g_Timeout = 0, $g_hMsgBoxOldProc, $g_hMsgBoxBrush, $g_hMsgBoxBtn = 0, $g_bMsgBoxClosing = False Global $g_hMsgBoxSubProc = DllCallbackRegister("_MsgBoxProc", "lresult", "hwnd;uint;wparam;lparam") Func _WinAPI_SetDlgItemText($hDlg, $nIDDlgItem, $lpString) ;https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setdlgitemtextw Local $aRet = DllCall("user32.dll", "int", "SetDlgItemText", "hwnd", $hDlg, "int", $nIDDlgItem, "str", $lpString) If @error Then Return SetError(@error, @extended, 0) Return $aRet[0] EndFunc ;==>_WinAPI_SetDlgItemText Func _WinAPI_FindWindowEx($hParent, $sClass, $sTitle = "", $hAfter = 0) Local $ret = DllCall("user32.dll", "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 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 Func _MsgBoxProc($hWnd, $iMsg, $wParam, $lParam) If Not $g_hMsgBoxOldProc Then Return _WinAPI_DefWindowProc($hWnd, $iMsg, $wParam, $lParam) Switch $iMsg Case $WM_CTLCOLORSTATIC, $WM_CTLCOLORDLG, $WM_CTLCOLORBTN _WinAPI_SetTextColor($wParam, _ColorToCOLORREF($COLOR_TEXT_LIGHT)) _WinAPI_SetBkColor($wParam, _ColorToCOLORREF($COLOR_BG_DARK)) Return $g_hMsgBoxBrush Case $WM_ERASEBKGND ; Paint entire dialog background including button area Local $tRECT = _WinAPI_GetClientRect($hWnd) _WinAPI_FillRect($wParam, $tRECT, $g_hMsgBoxBrush) Return 1 Case $WM_PAINT Local $iRet = _WinAPI_CallWindowProc($g_hMsgBoxOldProc, $hWnd, $iMsg, $wParam, $lParam) Local $hDC = _WinAPI_GetDC($hWnd) Local $tRECT = _WinAPI_GetClientRect($hWnd), $tRECT2 $tRECT.top = $tRECT.bottom - 42 Local $hBrushFooter = _WinAPI_CreateSolidBrush(_ColorToCOLORREF($COLOR_HOTTRACK_MENU)) _WinAPI_FillRect($hDC, $tRECT, $hBrushFooter) _WinAPI_ReleaseDC($hWnd, $hDC) _WinAPI_DeleteObject($hBrushFooter) Return $iRet Case $WM_CLOSE If $g_idTImer Then _Timer_KillTimer($hWnd, $g_idTImer) $g_idTImer = 0 EndIf Case $WM_DESTROY If $g_idTImer Then _Timer_KillTimer($hWnd, $g_idTImer) $g_idTImer = 0 EndIf _WinAPI_SetWindowLong($hWnd, $GWL_WNDPROC, $g_hMsgBoxOldProc) _WinAPI_DeleteObject($g_hMsgBoxBrush) $g_hMsgBoxBrush = 0 EndSwitch Return _WinAPI_CallWindowProc($g_hMsgBoxOldProc, $hWnd, $iMsg, $wParam, $lParam) EndFunc Func _TimerProc($hWnd, $iMsg, $wParam, $lParam) If $g_bMsgBoxClosing Then Return If $g_Timeout <= 1 Then $g_bMsgBoxClosing = True _Timer_KillTimer($hWnd, $g_idTImer) _WinAPI_PostMessage($hWnd, $WM_CLOSE, 0, 0) Else $g_Timeout -= 1 _WinAPI_SetDlgItemText($hWnd, $IDOK + 1, $g_sBtn1_Txt & " [" & $g_Timeout & "]") EndIf EndFunc Func _CBTHookProc($nCode, $wParam, $lParam) If $nCode < 0 Then Return _WinAPI_CallNextHookEx($g_hMsgBoxHook, $nCode, $wParam, $lParam) Local Const $hHWND = HWnd($wParam) Switch $nCode Case $HCBT_ACTIVATE If _WinAPI_GetClassName($hHWND) = "#32770" Then If $g_Timeout Then $g_idTImer = _Timer_SetTimer($hHWND, 1000, "_TimerProc") _WinAPI_SetDlgItemText($wParam, $IDOK, $g_Timeout ? $g_sBtn1_Txt & " [" & $g_Timeout & "]" : $g_sBtn1_Txt) ; Title bar dark _WinAPI_DwmSetWindowAttribute($hHWND, $DWMWA_USE_IMMERSIVE_DARK_MODE, True) ; Dark theme current button $g_hMsgBoxBtn = _WinAPI_GetDlgItem($hHWND, $IDOK) _WinAPI_SetWindowTheme($g_hMsgBoxBtn, "DarkMode_Explorer", 0) _WinAPI_AllowDarkModeForWindow($g_hMsgBoxBtn, True) ; Dark theme for static controls (text + icon) Local $hStatic = _WinAPI_FindWindowEx($hHWND, "Static") $g_hStaticMsgBox = $hStatic While $hStatic _WinAPI_AllowDarkModeForWindow($hStatic, True) $hStatic = _WinAPI_FindWindowEx($hHWND, "Static", "", $hStatic) WEnd $g_hMsgBoxBrush = _WinAPI_CreateSolidBrush(_ColorToCOLORREF($COLOR_BG_DARK)) $g_hMsgBoxOldProc = _WinAPI_SetWindowLong($hHWND, $GWL_WNDPROC, DllCallbackGetPtr($g_hMsgBoxSubProc)) _WinAPI_RedrawWindow($hHWND, 0, 0, BitOR($RDW_INVALIDATE, $RDW_UPDATENOW, $RDW_ALLCHILDREN)) EndIf Case $HCBT_DESTROYWND If _WinAPI_GetClassName($hHWND) = "#32770" Then _Timer_KillTimer($hHWND, $g_idTImer) EndSwitch Return _WinAPI_CallNextHookEx($g_hMsgBoxHook, $nCode, $wParam, $lParam) EndFunc ;==>_CBTHookProc Func MsgBoxEx($sText, $sTitle = Default, $iTimeout = 0, $iFlag = Default, $sBtn_Txt = Default, $hParentHWND = "") If $sBtn_Txt <> Default Then $g_sBtn1_Txt = $sBtn_Txt If $iFlag = Default Then $iFlag = $g_iFlagDefault $g_Timeout = $iTimeout Local $hMsgProc = DllCallbackRegister("_CBTHookProc", "int", "uint;wparam;lparam") Local Const $hThreadID = _WinAPI_GetCurrentThreadId() $g_hMsgBoxHook = _WinAPI_SetWindowsHookEx($WH_CBT, DllCallbackGetPtr($hMsgProc), Null, $hThreadID) If $sTitle = Default Then $sTitle = "Information" Local Const $iReturn = MsgBox($iFlag, $sTitle, $sText, $iTimeout, $hParentHWND) If $g_hMsgBoxHook Then _WinAPI_UnhookWindowsHookEx($g_hMsgBoxHook) DllCallbackFree($hMsgProc) Return $iReturn EndFunc ;==>MsgBoxEx Func _WinAPI_AllowDarkModeForWindow($hWND, $bAllow = True) Local $aResult = DllCall("UxTheme.dll", "bool", 133, "hwnd", $hWND, "bool", $bAllow) If @error Then Return SetError(1, 0, False) Return ($aResult[0] <> 0) EndFunc ;==>_WinAPI_AllowDarkModeForWindow ConsoleWrite(MsgBoxEx("This is a test", "Information", 5) & @CRLF) Any idea how to prevend it?
-
UEZ reacted to a post in a topic:
SampleControls.au3 in Dark Mode
-
UEZ reacted to a post in a topic:
DesktopClock
-
Salut wakillon, nice code. 👍 1) to enhance the quality of the clock text display you may use GDI+. On black background the text antialias looks not good. Enhanced example from here: ;Coded by UEZ build 2026-03-18 #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> Global Const $SC_DRAGMOVE = 0xF012 Global $iW = 300, $iH = 100, $hHBitmap Global $hGUI = GUICreate("GDI+ Transparent Digital Clock", $iW, $iH, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) GUISetState(@SW_SHOW, $hGUI) _GDIPlus_Startup() Global $hBrush = _GDIPlus_BrushCreateSolid(0xD80000A0) Global $hPen= _GDIPlus_PenCreate(0xFFF0F0F0) Global $hFormat = _GDIPlus_StringFormatCreate() Global $hFamily = _GDIPlus_FontFamilyCreate("Impact") Global $tLayout = _GDIPlus_RectFCreate(0, 0, $iW, $iH) _GDIPlus_StringFormatSetAlign($hFormat, 0) Global $hImage = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Global $hGfx = _GDIPlus_ImageGetGraphicsContext($hImage) _GDIPlus_GraphicsSetTextRenderingHint($hGfx, 4) _GDIPlus_GraphicsSetSmoothingMode($hGfx, 4) Global $hPath = _GDIPlus_PathCreate() GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") _ShowTime() AdlibRegister("_ShowTime", 1000) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE AdlibUnRegister("_ShowTime") _WinAPI_DeleteObject($hHBitmap) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hBrush) _GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hGfx) _GDIPlus_ImageDispose($hImage) _GDIPlus_PathDispose($hPath) _GDIPlus_Shutdown() GUIDelete() Func _ShowTime() _GDIPlus_GraphicsClear($hGfx, 0x00000000) _GDIPlus_PathReset($hPath) _GDIPlus_PathAddString($hPath, @HOUR & ":" & @MIN & ":" & @SEC, $tLayout, $hFamily, 0, 56, $hFormat) _GDIPlus_GraphicsFillPath($hGfx, $hPath, $hBrush) _GDIPlus_GraphicsDrawPath($hGfx, $hPath, $hPen) $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _WinAPI_BitmapDisplayTransparentInGUI($hHBitmap, $hGUI) _WinAPI_DeleteObject($hHBitmap) EndFunc Func _WinAPI_BitmapDisplayTransparentInGUI(ByRef $hHBitmap, ByRef $hGUI, $iOpacity = 0xFF, $bReleaseGDI = True) If Not BitAND(GUIGetStyle($hGUI)[1], $WS_EX_LAYERED) = $WS_EX_LAYERED Then Return SetError(1, 0, 0) Local $tDim = DllStructCreate($tagBITMAP) If Not _WinAPI_GetObject($hHBitmap, DllStructGetSize($tDim), DllStructGetPtr($tDim)) Then Return SetError(2, 0, 0) Local $tSize = DllStructCreate($tagSIZE), $tSource = DllStructCreate($tagPOINT), $tBlend = DllStructCreate($tagBLENDFUNCTION) Local Const $hScrDC = _WinAPI_GetDC(0), $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC), $hOld = _WinAPI_SelectObject($hMemDC, $hHBitmap) $tSize.X = $tDim.bmWidth $tSize.Y = $tDim.bmHeight $tBlend.Alpha = $iOpacity $tBlend.Format = 1 _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, DllStructGetPtr($tSize), $hMemDC, DllStructGetPtr($tSource), 0, DllStructGetPtr($tBlend), $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteDC($hMemDC) If $bReleaseGDI Then _WinAPI_DeleteObject($hHBitmap) Return True EndFunc Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) Switch $hWnd Case $hGUI _SendMessage($hWnd, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndSwitch EndFunc ;==>_WM_LBUTTONDOWN Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) If ($iMsg = $WM_NCHITTEST) Then Return $HTCAPTION EndFunc 2) GUICtrlSetData($idLabelDate, _StringProper(_DateDayOfWeek(@WDAY, 2)) & ' ' & @MDAY & ' ' & _StringProper(_DateToMonth(@MON, 2)) & ' ' & @YEAR) 2nd _StringProper make the char in between upper case -> MäRz 2026. 3) Maybe you can add background color check for upper and lower part separately. 4) The icon flashing in the system tray is a bit annoying. Merci.
-
UEZ reacted to a post in a topic:
SampleControls.au3 in Dark Mode
-
WildByDesign reacted to a post in a topic:
SampleControls.au3 in Dark Mode
-
This should do the trick: ... Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) ... ; --- 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 $tNMCD.ItemState = BitXOR($tNMCD.ItemState, $CDIS_FOCUS) Return $CDRF_NOTIFYSUBITEMDRAW Case 0x00010001 ;BitOR($CDDS_SUBITEM, $CDDS_ITEMPREPAINT) Switch $dwItemSpec Case $TBCD_THUMB Local $iL = $tNMCD.left Local $iT = $tNMCD.top Local $iR = $tNMCD.right - 1 Local $iB = $tNMCD.bottom Local $iMid = ($iL + $iR) / 2 Local $iSplit = $iB - ($iR - $iL) / 2 ; Hover check via cursor position Local $tPt = DllStructCreate($tagPOINT) DllCall("user32.dll", "bool", "GetCursorPos", "struct*", $tPt) DllCall("user32.dll", "bool", "ScreenToClient", "hwnd", $hWndFrom, "struct*", $tPt) Local $bHot = ($tPt.X >= $iL And $tPt.X <= $iR And $tPt.Y >= $iT And $tPt.Y <= $iB) 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 Local $hBrush = _WinAPI_CreateSolidBrush(_ColorToCOLORREF($bHot ? $COLOR_TAB_ACCENT_LIGHT : $COLOR_TAB_ACCENT)) Local $hPen = _WinAPI_CreatePen(0, 1, _ColorToCOLORREF($COLOR_CONTROL_BG)) Local $hOldBrush = _WinAPI_SelectObject($hDC, $hBrush) Local $hOldPen = _WinAPI_SelectObject($hDC, $hPen) DllCall("gdi32.dll", "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 Case $TBCD_CHANNEL Local $hBrush = _WinAPI_CreateSolidBrush(_ColorToCOLORREF($COLOR_MENU_SELECT)) Local $tRECT2 = DllStructCreate($tagRECT) $tRECT2.Left = $tNMCD.left $tRECT2.Top = $tNMCD.top $tRECT2.Right = $tNMCD.right $tRECT2.Bottom = $tNMCD.bottom _WinAPI_FillRect($hDC, $tRECT2, $hBrush) _WinAPI_DeleteObject($hBrush) Return $CDRF_SKIPDEFAULT Case Else Return $CDRF_DODEFAULT ; channel + ticks drawn by Windows EndSwitch EndSwitch EndIf ...
-
auto-it-tous reacted to a post in a topic:
SampleControls.au3 in Dark Mode
-
Convert Hex to Binary and extract specific Bits
UEZ replied to ken82m's topic in AutoIt General Help and Support
Here my approach which is similar to Andreik's version. ;coded by UEZ build 2026-03-14 #Include <String.au3> ConsoleWrite(ExtractBits("303425637013293133FDA4D5", 39, 58) & @CRLF) Func Int2Bin($in) If IsFloat($in) Or IsString($in) Then Return SetError(1, 0, "") If $in = 0 Then Return 0 Local $bin = "", $n = $in < 0 If $n Then $in = -$in While $in $bin &= BitAND($in, 1) $in = BitShift($in, 1) WEnd Return ($n ? "-" : "") & StringReverse($bin) EndFunc Func ExtractBits($sHex, $bStart, $bEnd) Local $i, $sBin = "", $sExtractedBin, $iResult = 0, $n For $i = 1 To StringLen($sHex) $n = Dec(StringMid($sHex, $i, 1)) If @error Then ContinueLoop $sBin &= StringFormat("%04s", Int2Bin($n)) Next $sExtractedBin = StringReverse(StringMid($sBin, $bStart, $bEnd - $bStart + 1)) For $i = 1 To StringLen($sExtractedBin) $n = StringMid($sExtractedBin, $i, 1) If Not $n Then ContinueLoop $iResult += $n * 2 ^ ($i - 1) Next Return $iResult EndFunc -
Hmmm, I have no problems with the label sizes - thus I cannot reproduce it. Another white line seems to occur at 200% above the menus At 200% Red line is just for testing purposes.
-
WildByDesign reacted to a post in a topic:
SampleControls.au3 in Dark Mode
-
I cannot see in the screenshots any misplacement except the screenshot from @argumentum
-
Back in my office with 3 monitors: checked the _OverpaintWhiteLine() and yes, didn't work. Changed it to the code above and it seems to work now - please test!
-
UEZ reacted to a post in a topic:
SampleControls.au3 in Dark Mode
-
Hmm. when I start it at 175% or from 100% -> 175% . I had also the problems with the measurement of the menus but for me it works as you can see in the screenshot.