wakillon Posted Wednesday at 11:23 AM Posted Wednesday at 11:23 AM (edited) Before I used the free DesktopDigitalClock from softwareok.com which is very good But sometimes the clock bothered me because I couldn't see what was behind it on the screen and there was no way to move it quickly The second problem was that the clock's display color made the time become unreadable depending on the color of the window behind it So, why not create my own that would be draggable and would adapt its display color (dark/light) to the window located behind it See tray menu for options Script available in download section : DesktopClock.7z Edited yesterday at 10:36 AM by wakillon ioa747, UEZ and WildByDesign 3 AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
UEZ Posted Wednesday at 03:32 PM Posted Wednesday at 03:32 PM (edited) 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: expandcollapse popup;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. Edited Wednesday at 03:46 PM 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
wakillon Posted Thursday at 02:52 PM Author Posted Thursday at 02:52 PM Hallo UEZ und vielen Dank 😉 1) I figured you were going to ask that 😂 I wanted to do something simple with Labels, but no problem, i will do a second version with gdi+ to improve the display 2) Instead of _StringProper could you try with _StringTitleCase to find out if it works for German language 3) For the color check, are you talking about each line of text ? 4) After all these years, you haven't noticed that most of my scripts have a blinking icon ? 😉 AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
UEZ Posted Thursday at 03:09 PM Posted Thursday at 03:09 PM 9 minutes ago, wakillon said: Hallo UEZ und vielen Dank 😉 1) I figured you were going to ask that 😂 I wanted to do something simple with Labels, but no problem, i will do a second version with gdi+ to improve the display 2) Instead of _StringProper could you try with _StringTitleCase to find out if it works for German language 3) For the color check, are you talking about each line of text ? 4) After all these years, you haven't noticed that most of my scripts have a blinking icon ? 😉 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. 😄 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
wakillon Posted Thursday at 03:35 PM Author Posted Thursday at 03:35 PM (edited) Something like this ? Edited Thursday at 03:37 PM by wakillon AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
UEZ Posted Thursday at 03:43 PM Posted Thursday at 03:43 PM Yes. 👍 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
wakillon Posted yesterday at 10:38 AM Author Posted yesterday at 10:38 AM DesktopClock v1.0.0.3.au3 updated to GDI+ Version UEZ 1 AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
UEZ Posted yesterday at 11:46 AM Posted yesterday at 11:46 AM 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. 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
wakillon Posted yesterday at 12:14 PM Author Posted yesterday at 12:14 PM You are right I just thought of another problem The "pixelgetcolor" function is done on the left side of the GUI, it would be necessary to detect if the GUI is at the extreme left of the screen to use the function on the right AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
wakillon Posted yesterday at 12:35 PM Author Posted yesterday at 12:35 PM DesktopClock v1.0.0.4.au3 updated AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now