Popular Post therks Posted April 30, 2020 Popular Post Share Posted April 30, 2020 (edited) It seems there are not many screensavers here in the examples forum. Thought maybe I could share mine. I'll admit some of the code is sloppy, global vars declared in functions, etc. But I started writing it almost 10 years ago and I just don't have the motivation to clean it up and rewrite from scratch. 😅 Maybe some day.. but for now, here's the code: expandcollapse popup; Big thanks to UEZ (AutoIt forums) for his help with the GDI programming. #NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=FloatingClock.ico #AutoIt3Wrapper_Outfile=FloatingClock.scr #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_UseX64=y #AutoIt3Wrapper_Res_Fileversion=1.0.1.3 #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=n #AutoIt3Wrapper_Run_Before=IF "%fileversion%" NEQ "" COPY "%in%" "%scriptdir%\%scriptfile% (v%fileversion%).au3" #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Math.au3> #Include <GDIPlus.au3> #include <Misc.au3> #include <Color.au3> #include <WinAPIProc.au3> #include <WinAPISys.au3> Global $IS_PREVIEW = False Global $TARGET_SPEED = 0.2, $DRIFT_SPEED = 100, $VELOC_DECAY = 1.01, $PROX_RADIUS = 100 Global $TIME_STRING[8], $TEXT_WIDTH, $TEXT_HEIGHT Global Enum $TP_X, $TP_Y, $TP_W, $TP_H, $TP_CHAR, $TP_UB Global $TIME_PIECES[8][$TP_UB] Global Enum $TG_X, $TG_Y, $TG_XVEL, $TG_YVEL, $TG_UB Global $TARGET_FOLLOW[$TG_UB], $TARGET_RANDOM[2] Global $CANVAS_X = _WinAPI_GetSystemMetrics($SM_XVIRTUALSCREEN) Global $CANVAS_Y = _WinAPI_GetSystemMetrics($SM_YVIRTUALSCREEN) Global $CANVAS_WIDTH = _WinAPI_GetSystemMetrics($SM_CXVIRTUALSCREEN) Global $CANVAS_HEIGHT = _WinAPI_GetSystemMetrics($SM_CYVIRTUALSCREEN) Global Enum $SET_REGKEY, $SET_ANTIALIAS, $SET_REFRESH, $SET_RAINBOW, $SET_STATIC, $SET_24HOUR, $SET_UB Global $SETTINGS[$SET_UB] = [ 'HKCU\Software\therkSoft\FloatingClock' ] If @Compiled Then If $CmdLine[0] Then Switch StringLeft($CmdLine[1], 2) Case '/p' If $CmdLine[0] > 1 Then _PreviewSaver($CmdLine[2]) ElseIf StringTrimLeft($CmdLine[1], 3) Then _PreviewSaver(StringTrimLeft($CmdLine[1], 3)) Else Exit EndIf Case '/s' _Singleton('FloatingClock.main') _MainSaver() Case Else _Config() EndSwitch Else _Config() EndIf Else _Config() GUIDelete() Sleep(500) _MainSaver() EndIf Func _Config() _LoadSettings() Local $iStaticColorSel Local $hGUIConfig = GUICreate('Floating Clock Config', 210, 160, Default, Default, BitOR($WS_CAPTION, $WS_POPUP, $WS_SYSMENU)) GUICtrlCreateGroup('Text color:', 5, 5, 200, 50) Local $ra_RainbowColor = GUICtrlCreateRadio('Rainbow', 25, 25, 70, 20) If $SETTINGS[$SET_RAINBOW] Then GUICtrlSetState(-1, $GUI_CHECKED) Local $ra_StaticColor = GUICtrlCreateRadio('Static: ', 100, 25, 50, 20) If Not $SETTINGS[$SET_RAINBOW] Then GUICtrlSetState(-1, $GUI_CHECKED) Local $bt_StaticColor = GUICtrlCreateButton('', 150, 25, 30, 20) GUICtrlSetBkColor(-1, $SETTINGS[$SET_STATIC]) Local $ch_AntiAlias = GUICtrlCreateCheckbox('Anti-alias text', 5, 60, 100, 20) If $SETTINGS[$SET_ANTIALIAS] Then GUICtrlSetState(-1, $GUI_CHECKED) Local $ch_24Hour = GUICtrlCreateCheckbox('24 hour clock', 105, 60, 100, 20) If $SETTINGS[$SET_24HOUR] Then GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlCreateLabel('Animation refresh rate:', 5, 85, 110, 20, $SS_CENTERIMAGE) Local $in_Refresh = GUICtrlCreateInput($SETTINGS[$SET_REFRESH], 115, 85, 30, 20, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER, $ES_RIGHT)) GUICtrlCreateLabel(' (ms)', 145, 85, 25, 20, $SS_CENTERIMAGE) Local $bt_OK = GUICtrlCreateButton('OK', 80, 115, 60, 25) GUICtrlSetState(-1, $GUI_DEFBUTTON) Local $bt_Cancel = GUICtrlCreateButton('Cancel', 145, 115, 60, 25) GUICtrlCreateLabel(' Version: ' & FileGetVersion(@ScriptFullPath) & ' ', 0, 145, 210, 15, BitOR($SS_SUNKEN, $SS_CENTERIMAGE, 0)) GUICtrlSetFont(-1, 7) GUISetState() While 1 Local $iGM = GUIGetMsg() Switch $iGM Case $bt_StaticColor ControlClick($hGUIConfig, '', $ra_StaticColor) $iStaticColorSel = _ChooseColor(2, $SETTINGS[$SET_STATIC], 2, $hGUIConfig) If $iStaticColorSel <> -1 Then $SETTINGS[$SET_STATIC] = $iStaticColorSel GUICtrlSetBkColor($bt_StaticColor, $SETTINGS[$SET_STATIC]) EndIf Case $bt_OK $SETTINGS[$SET_REFRESH] = Int(GUICtrlRead($in_Refresh)) If $SETTINGS[$SET_REFRESH] < 0 Then $SETTINGS[$SET_REFRESH] = 1 $SETTINGS[$SET_ANTIALIAS] = 0 If BitAND(GUICtrlRead($ch_AntiAlias), $GUI_CHECKED) Then $SETTINGS[$SET_ANTIALIAS] = 1 $SETTINGS[$SET_RAINBOW] = 0 If BitAND(GUICtrlRead($ra_RainbowColor), $GUI_CHECKED) Then $SETTINGS[$SET_RAINBOW] = 1 $SETTINGS[$SET_24HOUR] = 0 If BitAND(GUICtrlRead($ch_24Hour), $GUI_CHECKED) Then $SETTINGS[$SET_24HOUR] = 1 RegWrite($SETTINGS[$SET_REGKEY], 'Refresh', 'REG_DWORD', $SETTINGS[$SET_REFRESH]) RegWrite($SETTINGS[$SET_REGKEY], 'AntiAlias', 'REG_DWORD', $SETTINGS[$SET_ANTIALIAS]) RegWrite($SETTINGS[$SET_REGKEY], 'Rainbow', 'REG_DWORD', $SETTINGS[$SET_RAINBOW]) RegWrite($SETTINGS[$SET_REGKEY], 'Static', 'REG_DWORD', $SETTINGS[$SET_STATIC]) RegWrite($SETTINGS[$SET_REGKEY], '24Hour', 'REG_DWORD', $SETTINGS[$SET_24HOUR]) ExitLoop Case $bt_Cancel, $GUI_EVENT_CLOSE Exit EndSwitch WEnd EndFunc Func _PreviewSaver($iHandle) While WinExists('[CLASS:AutoIt v3 GUI; TITLE:FloatingClock.preview]') WinClose('[last]') WEnd _LoadSettings() Global $hWndCanvas = HWnd($iHandle) Local $aWinPos = WinGetPos($hWndCanvas) If @error Then Exit $CANVAS_WIDTH = $aWinPos[2] $CANVAS_HEIGHT = $aWinPos[3] $PROX_RADIUS = 10 Global $IS_PREVIEW = $hWndCanvas _Setup() AdlibRegister('_DrawingProcess', $SETTINGS[$SET_REFRESH]) GUICreate('FloatingClock.preview', 400, 100) Local $iParentProc = _WinAPI_GetParentProcess(@AutoItPID), $aChildProcs While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch $aChildProcs = _WinAPI_EnumChildProcess($iParentProc) If Not @error And $aChildProcs[0][0] > 1 Then Exit WEnd EndFunc Func _MainSaver() _LoadSettings() Global $hWndCanvas = GUICreate('', $CANVAS_WIDTH, $CANVAS_HEIGHT, $CANVAS_X, $CANVAS_Y, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) GUISetCursor(16, 1) _Setup() Sleep(500) GUISetState(@SW_SHOW) AdlibRegister('_DrawingProcess', $SETTINGS[$SET_REFRESH]) While 1 Sleep(10000) WEnd EndFunc Func _Setup() _GDIPlus_Startup() Global Const $hDC = _WinAPI_GetWindowDC($hWndCanvas) Global Const $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC) Global Const $hBitmap_backbuffer = _WinAPI_CreateCompatibleBitmap($hDC, $CANVAS_WIDTH, $CANVAS_HEIGHT) Global Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hBitmap_backbuffer) Global Const $hBackbuffer = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) If $SETTINGS[$SET_ANTIALIAS] Then _GDIPlus_GraphicsSetTextRenderingHint($hBackbuffer, 4) ; Anti-alias font? Global Const $hBrush_Clear = _GDIPlus_BrushCreateSolid(0xFF000000) Global Const $hBrush_Draw = _GDIPlus_BrushCreateSolid(BitOR(0xFF000000, $SETTINGS[$SET_STATIC])) Global Const $hPen_Draw = _GDIPlus_PenCreate(0xFFFFFFFF) Global Const $hFormat = _GDIPlus_StringFormatCreate(0x4004) _GDIPlus_StringFormatSetAlign($hFormat, 0) Global Const $hFamily = _GDIPlus_FontFamilyCreate('Arial') Global Const $hFont = _GDIPlus_FontCreate($hFamily, $CANVAS_HEIGHT / 8, 0) Global Const $tLayout = _GDIPlus_RectFCreate(0, 0, 0, 0) OnAutoItExitRegister('_Exit') Local $colon = _GDIPlus_GraphicsMeasureString($hBackbuffer, ':', $hFont, $tLayout, $hFormat) $TEXT_HEIGHT = DllStructGetData($colon[0], 'Height') $colon = DllStructGetData($colon[0], 'Width') Local $num = _GDIPlus_GraphicsMeasureString($hBackbuffer, '8', $hFont, $tLayout, $hFormat) $num = DllStructGetData($num[0], 'Width') $TEXT_WIDTH = ($colon * 2 + $num * 5) * 0.6 + $num $TARGET_FOLLOW[$TG_X] = Random(0, $CANVAS_WIDTH - $TEXT_WIDTH, 1) $TARGET_FOLLOW[$TG_Y] = Random(0, $CANVAS_HEIGHT - $TEXT_HEIGHT, 1) $TARGET_FOLLOW[$TG_X] = ($CANVAS_WIDTH - $TEXT_WIDTH) / 2 $TARGET_FOLLOW[$TG_Y] = ($CANVAS_HEIGHT - $TEXT_HEIGHT) / 2 For $i = 0 To 7 $TIME_PIECES[$i][$TP_X] = ($CANVAS_WIDTH - $num) / 2 $TIME_PIECES[$i][$TP_Y] = ($CANVAS_HEIGHT - $TEXT_HEIGHT) / 2 Next _TargetRandomize() _GDIPlus_GraphicsFillRect($hBackbuffer, 0, 0, $CANVAS_WIDTH, $CANVAS_HEIGHT, $hBrush_Clear) EndFunc Func _DrawingProcess() If Not $IS_PREVIEW Then If _WinAPI_GetIdleTime() < 500 Then _Exit() Else If Not WinExists($IS_PREVIEW) Then _Exit() EndIf _TargetFollowing() _TimePieceMove() _WinAPI_BitBlt($hDC, 0, 0, $CANVAS_WIDTH, $CANVAS_HEIGHT, $hDC_backbuffer, 0, 0, $SRCCOPY) ; Copy buffer to main EndFunc Func _TargetRandomize() Global $TARGET_RANDOM[2] = [ Random(0, $CANVAS_WIDTH - $TEXT_WIDTH, 1), Random(0, $CANVAS_HEIGHT - $TEXT_HEIGHT, 1) ] EndFunc Func _TargetFollowing() Local $xDiff = $TARGET_RANDOM[$TG_X] - $TARGET_FOLLOW[$TG_X] Local $yDiff = $TARGET_RANDOM[$TG_Y] - $TARGET_FOLLOW[$TG_Y] If Sqrt($xDiff ^ 2 + $yDiff ^ 2) < $PROX_RADIUS Then _TargetRandomize() EndIf $TARGET_FOLLOW[$TG_XVEL] += $xDiff * $TARGET_SPEED /1000 $TARGET_FOLLOW[$TG_YVEL] += $yDiff * $TARGET_SPEED /1000 If ($xDiff < 0 And $TARGET_FOLLOW[$TG_XVEL] > 0) Or ($xDiff > 0 And $TARGET_FOLLOW[$TG_XVEL] < 0) Then $TARGET_FOLLOW[$TG_XVEL] /= $VELOC_DECAY EndIf If ($yDiff < 0 And $TARGET_FOLLOW[$TG_YVEL] > 0) Or ($yDiff > 0 And $TARGET_FOLLOW[$TG_YVEL] < 0) Then $TARGET_FOLLOW[$TG_YVEL] /= $VELOC_DECAY EndIf $TARGET_FOLLOW[$TG_X] += $TARGET_FOLLOW[$TG_XVEL] $TARGET_FOLLOW[$TG_Y] += $TARGET_FOLLOW[$TG_YVEL] If $TARGET_FOLLOW[$TG_X] > $CANVAS_WIDTH - $TEXT_WIDTH And $TARGET_FOLLOW[$TG_XVEL] > 0 Then $TARGET_FOLLOW[$TG_XVEL] *= -1 $TARGET_FOLLOW[$TG_X] = $CANVAS_WIDTH - $TEXT_WIDTH ElseIf $TARGET_FOLLOW[$TG_X] < 0 And $TARGET_FOLLOW[$TG_XVEL] < 0 Then $TARGET_FOLLOW[$TG_XVEL] *= -1 $TARGET_FOLLOW[$TG_X] = 0 EndIf If $TARGET_FOLLOW[$TG_Y] > $CANVAS_HEIGHT - $TEXT_HEIGHT And $TARGET_FOLLOW[$TG_YVEL] > 0 Then $TARGET_FOLLOW[$TG_YVEL] *= -1 $TARGET_FOLLOW[$TG_Y] = $CANVAS_HEIGHT - $TEXT_HEIGHT ElseIf $TARGET_FOLLOW[$TG_Y] < 0 And $TARGET_FOLLOW[$TG_YVEL] < 0 Then $TARGET_FOLLOW[$TG_YVEL] *= -1 $TARGET_FOLLOW[$TG_Y] = 0 EndIf EndFunc Func _TimePieceMove() Local $iHour = Int(@HOUR) If Not $SETTINGS[$SET_24HOUR] Then If $iHour = 0 Then $iHour = 12 If $iHour > 12 Then $iHour -= 12 EndIf Local $sTimeString = StringFormat('%2s:%02d:%02d', $iHour, @MIN, @SEC) $TIME_STRING = StringSplit($sTimeString, '', 2) If UBound($TIME_STRING) <> 8 Then AdlibUnRegister('_DrawingProcess') MsgBox(0x42010, 'Error parsing time string.', '$sTimeString = "' & $sTimeString & '" (' & StringLen($sTimeString) & ')') Exit EndIf ; Clear previous drawing For $idx = 0 To 7 _GDIPlus_GraphicsFillRect($hBackbuffer, $TIME_PIECES[$idx][$TP_X], $TIME_PIECES[$idx][$TP_Y], $TIME_PIECES[$idx][$TP_W], $TIME_PIECES[$idx][$TP_H], $hBrush_Clear) Next _StringPlace(0, $TARGET_FOLLOW[$TG_X], $TARGET_FOLLOW[$TG_Y]) For $i = 1 To 7 _StringPlace($i, $TIME_PIECES[$i-1][$TP_X] + $TIME_PIECES[$i-1][$TP_W] * 0.6, $TIME_PIECES[$i-1][$TP_Y]) Next EndFunc Func _StringPlace($idx, $x, $y) Local $aHSL[3] = [ 240, 240, 240 ] If $TIME_STRING[$idx] = ' ' Then $TIME_STRING[$idx] = '' $TIME_PIECES[$idx][$TP_CHAR] = $TIME_STRING[$idx] Local $aMeasure = _GDIPlus_GraphicsMeasureString($hBackbuffer, $TIME_PIECES[$idx][$TP_CHAR], $hFont, $tLayout, $hFormat) $TIME_PIECES[$idx][$TP_W] = DllStructGetData($aMeasure[0], 'Width') $TIME_PIECES[$idx][$TP_H] = DllStructGetData($aMeasure[0], 'Height') $TIME_PIECES[$idx][$TP_X] += ($x - $TIME_PIECES[$idx][$TP_X]) * $DRIFT_SPEED /1000 $TIME_PIECES[$idx][$TP_Y] += ($y - $TIME_PIECES[$idx][$TP_Y]) * $DRIFT_SPEED /1000 DllStructSetData($aMeasure[0], 'x', $TIME_PIECES[$idx][$TP_X]) DllStructSetData($aMeasure[0], 'y', $TIME_PIECES[$idx][$TP_Y]) If $SETTINGS[$SET_RAINBOW] Then $aHSL[0] = $TIME_PIECES[$idx][$TP_X] / $CANVAS_WIDTH * 480 $aHSL[2] = 200 - ($TIME_PIECES[$idx][$TP_Y] / $CANVAS_HEIGHT * 160) ; Range: 200-40 top-bottom Local $iBrushColor = _ColorSetRGB(_ColorConvertHSLtoRGB($aHSL)) _GDIPlus_BrushSetSolidColor($hBrush_Draw, 0xFF000000 + $iBrushColor) EndIf _GDIPlus_GraphicsDrawStringEx($hBackbuffer, $TIME_PIECES[$idx][$TP_CHAR], $hFont, $aMeasure[0], $hFormat, $hBrush_Draw) Return $aMeasure[0] EndFunc Func _LoadSettings() $SETTINGS[$SET_ANTIALIAS] = RegRead($SETTINGS[$SET_REGKEY], 'AntiAlias') If @error Then $SETTINGS[$SET_ANTIALIAS] = 1 $SETTINGS[$SET_REFRESH] = RegRead($SETTINGS[$SET_REGKEY], 'Refresh') If @error Then $SETTINGS[$SET_REFRESH] = 10 $SETTINGS[$SET_RAINBOW] = RegRead($SETTINGS[$SET_REGKEY], 'Rainbow') If @error Then $SETTINGS[$SET_RAINBOW] = 1 $SETTINGS[$SET_STATIC] = RegRead($SETTINGS[$SET_REGKEY], 'Static') If @error Then $SETTINGS[$SET_STATIC] = 0xffffff $SETTINGS[$SET_24HOUR] = RegRead($SETTINGS[$SET_REGKEY], '24Hour') If @error Then $SETTINGS[$SET_24HOUR] = 1 EndFunc Func _Exit() _GDIPlus_GraphicsFillRect($hBackbuffer, 0, 0, $CANVAS_WIDTH, $CANVAS_HEIGHT, $hBrush_Clear) _WinAPI_BitBlt($hDC, 0, 0, $CANVAS_WIDTH, $CANVAS_HEIGHT, $hDC_backbuffer, 0, 0, $SRCCOPY) ; Copy buffer to main AdlibUnRegister('_DrawingProcess') _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hBrush_Draw) _GDIPlus_GraphicsDispose($hBackbuffer) _WinAPI_SelectObject($hDC, $DC_obj) _WinAPI_DeleteDC($hDC_backbuffer) _WinAPI_DeleteObject($hBitmap_backbuffer) _WinAPI_ReleaseDC($hWndCanvas, $hDC) _GDIPlus_Shutdown() Exit EndFunc Edited May 2, 2020 by therks Update for multi-monitor argumentum, UEZ, funkey and 2 others 4 1 My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
UEZ Posted April 30, 2020 Share Posted April 30, 2020 Looks nice @therks. But the clock animation seemed familiar to me. After a quick search I found it. therks 1 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
funkey Posted April 30, 2020 Share Posted April 30, 2020 Looks great, works good! But for a screensaver I would need a multiple monitor support to use it. therks 1 Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
therks Posted April 30, 2020 Author Share Posted April 30, 2020 1 hour ago, UEZ said: Looks nice @therks. But the clock animation seemed familiar to me. After a quick search I found it. Ah I knew I had asked for help with it back in the day. I certainly didn't figure out all that extra fancy GDI stuff out myself. 😁 My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
therks Posted April 30, 2020 Author Share Posted April 30, 2020 44 minutes ago, funkey said: Looks great, works good! But for a screensaver I would need a multiple monitor support to use it. Ah yes, that's pretty common these days (probably more common than using screen savers actually). Unfortunately I don't have a multi monitor setup so I wouldn't even know where/how to start supporting that. 🙁 My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
UEZ Posted April 30, 2020 Share Posted April 30, 2020 I just checked the screensaver by copying to c:\Windows\SysWOW64\. If I select in preview window (monitor) your screensaver then it will not be closed when I switch to another one. Maybe this will not be an issue because when closing the screensaver window then it will close automatically all sub processes. Afaik remember it wasn't the case in previous os. The process was still running in the memory. Maybe this is a Windows10 feature to close all sub processes automatically. You can use Global Const $hFullScreen = WinGetHandle("Program Manager") Global Const $aFullScreen = WinGetPos($hFullScreen) to get the whole desktop size incl. multi monitors. therks 1 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
therks Posted April 30, 2020 Author Share Posted April 30, 2020 42 minutes ago, UEZ said: I just checked the screensaver by copying to c:\Windows\SysWOW64\. If I select in preview window (monitor) your screensaver then it will not be closed when I switch to another one. Maybe this will not be an issue because when closing the screensaver window then it will close automatically all sub processes. Afaik remember it wasn't the case in previous os. The process was still running in the memory. Maybe this is a Windows10 feature to close all sub processes automatically. You can use Global Const $hFullScreen = WinGetHandle("Program Manager") Global Const $aFullScreen = WinGetPos($hFullScreen) to get the whole desktop size incl. multi monitors. Ah yes, I couldn't figure out a clean way to have it close the preview process. If the application is sent a signal to close I don't know what it is. In my testing I found the same, the process died when the dialog was closed, and I believe this happened in Windows 7 at least as well so I guess I deemed it "good enough". I should probably do it properly though. And thanks for the suggestion for multi-mon. I'll have to implement that and throw it up here again for @funkey to test. 😁 My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
UEZ Posted April 30, 2020 Share Posted April 30, 2020 54 minutes ago, therks said: Ah yes, I couldn't figure out a clean way to have it close the preview process. If the application is sent a signal to close I don't know what it is. In my testing I found the same, the process died when the dialog was closed, and I believe this happened in Windows 7 at least as well so I guess I deemed it "good enough". I should probably do it properly though. And thanks for the suggestion for multi-mon. I'll have to implement that and throw it up here again for @funkey to test. 😁 I solved the process issue by getting the parent pid and checking if child pid count changed. If so, then the current screensaver can be closed. The screensaver will be call be parent process called rundll32.exe and should have always one child process -> the screensaver. I had also released some screensavers, so search for them and you will find the appropriate code section. 😉 therks 1 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
argumentum Posted April 30, 2020 Share Posted April 30, 2020 3 hours ago, therks said: I'll have to implement that and throw it up here again for @funkey to test. 😁 I too can test and attest therks 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
therks Posted May 1, 2020 Author Share Posted May 1, 2020 Alrighty, got my brother to test with his multi monitor setup and it seems to work fine. I'll update the code in the first post. argumentum 1 My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
therks Posted May 2, 2020 Author Share Posted May 2, 2020 So I did encounter a problem, @UEZ. When triggered manually everything worked fine, but when triggered by the system AutoIt can't find the "Program Manager" window. So I grabbed the dimensions using _WinAPI_GetSystemMetrics instead. argumentum 1 My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
UEZ Posted May 2, 2020 Share Posted May 2, 2020 1 hour ago, therks said: So I did encounter a problem, @UEZ. When triggered manually everything worked fine, but when triggered by the system AutoIt can't find the "Program Manager" window. So I grabbed the dimensions using _WinAPI_GetSystemMetrics instead. It can be that _WinAPI_GetSystemMetrics() is not dpi aware. Then you will get wrong values. Currently I cannot test multi monitor with different dpi settings. therks 1 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
therks Posted May 2, 2020 Author Share Posted May 2, 2020 Alrighty then. I think this will have to be another of those cases where I have to leave it as "good enough" for now. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
funkey Posted May 4, 2020 Share Posted May 4, 2020 Works fine now for my three Monitors. Thanks! therks 1 Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
Gianni Posted May 4, 2020 Share Posted May 4, 2020 2 hours ago, funkey said: ... for my three Monitors...! now I understand why of your eyes... P.S. sorry for the hilarity funkey 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
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