Search the Community
Showing results for tags 'Screensaver'.
-
Hello i am new here and this is my first thread in this script i used some code snippets from forum. I do not remember who these belonged to. Disabled ALT+F4 ALT+TAB TASK MANAGER LOCKING WINDOWS deleted items from ctrl+alt+delete screen (Lock Computer,Switch User,Sign Out,Chance a password,Task Manager) CTRL+ALT+DELETE (how ?) firstly we are disabled locking computer RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System', 'DisableLockWorkstation',"REG_DWORD",0x00000001) and then ctrl+alt+delete pressed IsDesktopLocked() triggered. we are calling Run("rundll32.exe user32.dll,LockWorkStation") command with checking if $blockctrlaltdel = 1 statements. then it return us to kiosk screen, because we are disabled locking computer. Func IsDesktopLocked() Local $hDesktop Local $iRet Local $iRC Local $sMsg Local Const $DESKTOP_SWITCHDESKTOP = 0x100 $hDesktop = DllCall("User32.dll", "int", "OpenDesktop", "str", "Default", "int", 0, "int", 0, "int", $DESKTOP_SWITCHDESKTOP) $iRet = DllCall("User32.dll", "int", "SwitchDesktop", "int", $hDesktop[0]) If IsArray($iRet) Then If $iRet[0] = 0 Then if $blockctrlaltdel = 1 Then Run("rundll32.exe user32.dll,LockWorkStation") EndIf $iRC = 1 ElseIf $iRet[0] = 1 Then $iRC = 0 EndIf Else EndIf DllCall("User32.dll", "int", "CloseDesktop", "int", $hDesktop[0]);<-- handle returned by "OpenDesktop" ;$iRet = DllCall("User32.dll", "int", "CloseDesktop", "int", $iRet[0]) Return ($iRC) EndFunc ;==>IsDesktopLocked maybe this blocked to lock computer when rdp session closed. i havent tried and This script needed to Google chrome and "WinLockDll.dll" to work. FULL SCRIPT #include <WinAPI.au3> #include <FontConstants.au3> #include <GUIConstants.au3> Opt('GUIOnEventMode', 1) Opt("TrayAutoPause", 0) HotKeySet("{ESCAPE}","_EXIT") ;~ $sFilePath = "D:\kiosk\" local $Form1,$blockctrlaltdel Global Const $VK_F4 = 0x73 Global $winlockdll = DllOpen(@ScriptDir&"\WinLockDll.dll") kullanimkapat() #region ; WinEventHook Global Const $EVENT_OPEN_DESKTOP_CHANGED = 0x0020 $h_DLL_User32 = DllOpen("User32.dll") $h_WinEventHook_Proc = DllCallbackRegister("_WinEventHook_Proc", "none", "hwnd;int;hwnd;long;long;int;int") If @error Then ConsoleWrite("Error DllCallbackRegister(_WinEventHook_Proc) did not succeed. FFH will exit now.") Exit EndIf $h_Hook = _WinEventHook_Set(0x0020, 0x0020, $h_DLL_User32) If @error Then ConsoleWrite("Error _WinEventHook_Set() did not succeed. FFH will exit now.") Exit EndIf OnAutoItExitRegister("_WinEventHook_UnSet") #endregion ; WinEventHook Global $winlockdll = DllOpen(@ScriptDir&"\WinLockDll.dll") Func kullanimkapat() $blockctrlaltdel = 1 Global $hHookProc = DllCallbackRegister("_KeyboardProc", "long", "int;wparam;lparam") Global $hHookKeyboard = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($hHookProc), _WinAPI_GetModuleHandle(0), 0) Global $hSysTray_Handle = DllCall("user32.dll", "HWND", "FindWindow", "str", "Shell_TrayWnd", "str", "") _WinAPI_ShellChangeNotify($SHCNE_ASSOCCHANGED, 0, 0, 0) _SendMessage($hSysTray_Handle[0], 0x5B4, 0, 0) DllCall($winlockdll, "Int", "Keys_Enable_Disable ", "Int", "1") DllCall($winlockdll, "Int", "TaskManager_Enable_Disable", "Int", "0") DllCall($winlockdll, "Int", "TaskSwitching_Enable_Disable", "Int", "0") DllCall($winlockdll, "Int", "Keys_Enable_Disable", "Int", "1") RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System', 'DisableChangePassword',"REG_DWORD",0x00000001) RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System', 'HideFastUserSwitching', "REG_DWORD",0x00000001) RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer', 'NoLogoff',"REG_DWORD",0x00000001) RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer', 'NoClose',"REG_DWORD",0x00000001) RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System', 'DisableTaskMgr',"REG_DWORD",0x00000001) RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System', 'DisableLockWorkstation',"REG_DWORD",0x00000001) FileDelete ( @LocalAppDataDir&"\Google\Chrome\User Data\Default\Preferences" ) ;~ Local $hFileOpen = FileOpen($sFilePath,BitOR(8,2)) ;~ FileWrite($hFileOpen,'<!DOCTYPE html><meta http-equiv="refresh" content="30"><html><head><script type="text/javascript">function disableselect(e){return!1}function reEnable(){return!0}document.onselectstart=new Function("return false"),document.oncontextmenu=new Function("return false"),window.sidebar&&(document.onmousedown=disableselect,document.onclick=reEnable);</script><style>#masano{top:50%;left:50%;width:250px;height:250px;margin-top:-125px;margin-left:-125px;border:1px solid red;background-color:red;position:fixed;font:normal 200px Calibri;line-height:250px;text-align:center;color:white}</style><title>*</title></head><body><div id="masano">'&@ComputerName&'</div></body></html>"') ;~ FileClose($hFileOpen);kiosk html writed Run("taskkill /im chrome.exe /f /t") Sleep(3000) ;~ Run(@HomeDrive&"\Program Files (x86)\Google\Chrome\Application\chrome.exe --kiosk "&$sFilePath) Run(@HomeDrive&"\Program Files (x86)\Google\Chrome\Application\chrome.exe --kiosk https://www.autoitscript.com/autoit3/files/graphics/autoit_10_wall_1920x1200.jpg") WinMinimizeAll() Global $hSplash = GuiCreate("", @DesktopWidth+5, @DesktopHeight+5, -5, -5,$WS_POPUP,$WS_THICKFRAME) ;invinsible fullscreen gui on top google chrome. GUISetBkColor (0xf0f8ff) WinSetTrans($hSplash, "", 5) GUISetState() WinSetOnTop($hSplash, "", 1) EndFunc Func kullanimAc() FileDelete ( @LocalAppDataDir&"\Google\Chrome\User Data\Default\Preferences" ) $blockctrlaltdel = 0 DllCallbackFree($hHookProc) If Not IsHWnd($hSysTray_Handle[0]) Then ShellExecute(@WindowsDir & "\Explorer.exe") DllCall($winlockdll, "Int", "Keys_Enable_Disable ", "Int", "0") DllCall($winlockdll, "Int", "TaskManager_Enable_Disable", "Int", "1") DllCall($winlockdll, "Int", "TaskSwitching_Enable_Disable", "Int", "1") DllCall($winlockdll, "Int", "Keys_Enable_Disable ", "Int", "0") RegDelete('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System','DisableChangePassword') RegDelete('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System', 'HideFastUserSwitching') RegDelete('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer', 'NoLogoff') RegDelete('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer', 'NoClose') RegDelete('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System', 'DisableTaskMgr') RegDelete('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System', 'DisableLockWorkstation') Run("taskkill /im chrome.exe /f /t") Sleep(500) GUIDelete($hSplash) Sleep(500) EndFunc Func _KeyboardProc($nCode, $wParam, $lParam) If $nCode < 0 Then Return _WinAPI_CallNextHookEx($hHookKeyboard, $nCode, $wParam, $lParam) Switch $wParam Case $WM_KEYDOWN, $WM_SYSKEYDOWN, $WM_KEYUP, $WM_SYSKEYUP Local $tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam) Local $vKode = DllStructGetData($tKEYHOOKS, "vkCode") Local $iFlags = DllStructGetData($tKEYHOOKS, "flags") Switch $vKode Case $VK_F4 If BitAND($iFlags, $LLKHF_ALTDOWN) Then Return -1 Else Return _WinAPI_CallNextHookEx($hHookKeyboard, $nCode, $wParam, $lParam) EndIf EndSwitch EndSwitch Return _WinAPI_CallNextHookEx($hHookKeyboard, $nCode, $wParam, $lParam) EndFunc #region ; WinEventHook Functions Func _WinEventHook_Proc($h_Hook, $iEvent, $hWnd, $idObject, $idChild, $iEventThread, $iEventTime) ;ConsoleWrite($hWnd & @TAB & $idObject & @CRLF) ConsoleWrite(TimerInit() & @tab & hex($iEvent,4) & @tab & "IsDesktopLocked()" & @tab & IsDesktopLocked() & @crlf) EndFunc ;==>_WinEventHook_Proc Func _WinEventHook_Set($iEventMin, $iEventMax, $hDLLUser32) Local $aRet Local Const $WINEVENT_OUTOFCONTEXT = 0x0 Local Const $WINEVENT_SKIPOWNPROCESS = 0x2 If Not $hDLLUser32 Or $hDLLUser32 = -1 Then $hDLLUser32 = "User32.dll" $aRet = DllCall($hDLLUser32, "hwnd", "SetWinEventHook", _ "uint", $iEventMin, _ "uint", $iEventMax, _ "hwnd", 0, _ "ptr", DllCallbackGetPtr($h_WinEventHook_Proc), _ "int", 0, _ "int", 0, _ "uint", $WINEVENT_OUTOFCONTEXT) ; BitOR($WINEVENT_OUTOFCONTEXT, $WINEVENT_SKIPOWNPROCESS) If @error Then Return SetError(@error, 0, 0) Return $aRet[0] EndFunc ;==>_WinEventHook_Set Func _WinEventHook_UnSet() If $h_WinEventHook_Proc Then DllCallbackFree($h_WinEventHook_Proc) EndIf If $h_Hook Then DllCall($h_DLL_User32, "int", "UnhookWinEvent", "hwnd", $h_Hook) If $h_DLL_User32 Then DllClose($h_DLL_User32) EndFunc ;==>_WinEventHook_UnSet #endregion ; WinEventHook Functions Func IsDesktopLocked() Local $hDesktop Local $iRet Local $iRC Local $sMsg Local Const $DESKTOP_SWITCHDESKTOP = 0x100 $hDesktop = DllCall("User32.dll", "int", "OpenDesktop", "str", "Default", "int", 0, "int", 0, "int", $DESKTOP_SWITCHDESKTOP) $iRet = DllCall("User32.dll", "int", "SwitchDesktop", "int", $hDesktop[0]) If IsArray($iRet) Then If $iRet[0] = 0 Then if $blockctrlaltdel = 1 Then Run("rundll32.exe user32.dll,LockWorkStation") EndIf $iRC = 1 ElseIf $iRet[0] = 1 Then $iRC = 0 EndIf Else EndIf DllCall("User32.dll", "int", "CloseDesktop", "int", $hDesktop[0]);<-- handle returned by "OpenDesktop" ;$iRet = DllCall("User32.dll", "int", "CloseDesktop", "int", $iRet[0]) Return ($iRC) EndFunc ;==>IsDesktopLocked Func _EXIT() kullanimAc() HotKeySet("{ESCAPE}") Exit EndFunc While 1 Sleep(100) WEnd WinLockDll.dll pc-kilitle.au3
-
- ctrl alt delete
- ctrl alt del
-
(and 3 more)
Tagged with:
-
Screensaver, Sleep, Lock and Power-Save Disabling
Ascend4nt posted a topic in AutoIt Example Scripts
Screensaver, Sleep, Workstation Lock, and Power-Save Disabling Since I see this question asked again and again, and the simple answer isn't always given (or at least, only half of it is), I'm posting this for reference. To disable Power-saving, Workstation Locking, Screensavers, etc., all that's needed is a call to SetThreadExecutionState. No need for timers, nor for emulating mouse or keyboard input. Just make a call to that API once to disable any locking/sleeping/screensaverin'. When you're done, make another call to it with the proper parameters (this part is important), and everything will be restored. NOTE: The 'execution state' should really only matter while the program that made the call is running (its supposed to be per-application). Once it is terminated, the execution state should be restored. However, there have been some unusual reports regarding this, especially when it is called by more than one process. The main functions in my module are _PowerKeepAlive() and _PowerResetState(). One keeps everything 'awake', the other reenables the default state of Windows power settings (including screensavers and workstation locking). The primary reason I've used this myself is for games that forget to call that API function, and after playing with the joystick for a while, a screensaver or lock-screen will pop up. Using these functions will workaround that problem. Also!: If you want to save and restore the current power-savings 'execution state', just pass the return value from _PowerKeepAlive() as the first argument to 'SetThreadExecutionState'. Anyway, here's the main module I use (example use is below): #include-once ; =============================================================================================================================== ; <_PowerKeepAlive.au3> ; ; Functions to prevent/disable sleep/power-savings modes (AND screensaver) ; ; Functions: ; _PowerKeepAlive() ; _PowerResetState() ; ; See also: ; <_ScreenSaverFunctions.au3> ; query, change, enable & disable screensaver. ; ; Author: Ascend4nt ; =============================================================================================================================== ; ========================================================================================================================== ; Func _PowerKeepAlive() ; ; Function to Prevent the Screensaver and Sleep/Power-savings modes from kicking in. ; NOTE: Be sure to reset this state on exit! ; ; Returns: ; Success: @error=0 & previous state as # (typically 0x80000000 [-2147483648]) ; Failure: @error set (returns 0x80000000, but thats just the normal state) ; @error = 2 = DLLCall error. @extended = DLLCall error code (see AutoIt Help) ; ; Author: Ascend4nt ; ========================================================================================================================== Func _PowerKeepAlive() #cs ; Flags: ; ES_SYSTEM_REQUIRED (0x01) -> Resets system Idle timer ; ES_DISPLAY_REQUIRED (0x02) -> Resets display Idle timer ; ES_CONTINUOUS (0x80000000) -> Forces 'continuous mode' -> the above 2 will not need to continuously be reset #ce Local $aRet=DllCall('kernel32.dll','long','SetThreadExecutionState','long',0x80000003) If @error Then Return SetError(2,@error,0x80000000) Return $aRet[0] ; Previous state (typically 0x80000000 [-2147483648]) EndFunc ; ========================================================================================================================== ; Func _PowerResetState() ; ; Function to Reset the Screensaver and Sleep/Power-savings modes to defaults. ; NOTE: The timer is reset on each call to this! ; ; Returns: ; Success: @error=0 & previous state as # ; Failure: @error set (returns 0x80000000, but thats just the normal state) ; @error = 2 = DLLCall error. @extended = DLLCall error code (see AutoIt Help) ; ; Author: Ascend4nt ; ========================================================================================================================== Func _PowerResetState() ; Flag: ES_CONTINUOUS (0x80000000) -> (default) -> used alone, it resets timers & allows regular sleep/power-savings mode Local $aRet=DllCall('kernel32.dll','long','SetThreadExecutionState','long',0x80000000) If @error Then Return SetError(2,@error,0x80000000) Return $aRet[0] ; Previous state EndFunc Example usage: #NoTrayIcon #include "_PowerKeepAlive.au3" ; Singleton code: If WinExists("SA_0bc53fe0-59c2-11e2-bcfd-0800200c9a66_SA") Then Exit AutoItWinSetTitle("SA_0bc53fe0-59c2-11e2-bcfd-0800200c9a66_SA") Opt("TrayOnEventMode", 0) Opt("TrayMenuMode", 1+2) TraySetClick(8+1) Local $iTrayExit = TrayCreateItem("Exit + Reenable Sleep") ; Disable screensaver, power-save, etc _PowerKeepAlive() ; Be sure to register this to reenable power-saving, screensaver, etc OnAutoItExitRegister("_PowerResetState") ; Now we're ready to accept messages TraySetState() While TrayGetMsg() <> $iTrayExit ; No need for sleep WEnd _PowerKeepAlive.au3- 7 replies
-
- screensaver
- workstation lock
-
(and 3 more)
Tagged with:
-
-
A little Screensaver based on FavIcons Like this screenshot Most websites use 16x16 Icons, so for a better display i used only those who have a 32x32 format. Thanks to : Ward for his BinaryCall UDF ( for call in memory lzma.dll and titchisid.dll ) and trancexx for his ResourcesViewerAndCompiler ( for create the huge icons resource dll ) If you have some time to loose, you can get files in the Download Section Edit 1 : Config is available via right click on compiled version. Edit 2 : Last version do not use lzma.dll and icons resource dll but an ImageList from a jpg for store the 730 "icons"
-
Some Screensavers I wrote (and more to come) using Direct2D. Download: AutoItScreenSavers.7z Run the scripts in TestMode by pressing F5 in SciTE Or compile them by pressing F7 and select the Screensaver in the Windows-Screensaver Settings The Direct2D-UDF in the download file is not the latest one - you find the newest version in my signature:
-
Entertainment The idea was to adapt the eagle.au3 example posted by mesale0077 making the bird fly across the monitor. This is the result: eagle fly GreenCan.au3 But, I was not really happy with the result, so I thought, maybe use the original animated gif and move it across the monitor using a transparent GUI. This is a script based on an example of trancexx' GIFAnimation udf. GIFAnimation.au3 is required for below example and can be found here: GIFAnimation.au3 I think the result is much better than the perforated GUI. The script is a kind of a screen saver, or at least a distractor for the eye. FlyingBird.au3 (bug fixed by Mesale0077) flying_bird.ico New examples: Crawling Frog: CrawlingFrog.au3 frog3.ico Cheetah and Tiger: see Post #13 for the more information Version 1.0.0.1 Small bugfix to avoid the current active GUI to flip to the background. Only For those who already tested version 1.0.0.0: same fix for the child script Don't start it but replace the old on in @TempDir & "GIFS" by this new version If you run the script, no big issue but you will have to process kill it... Cheetah and Tiger (Most recent example 1.0.1.0) CheetahRun.au3 _TigerWalk.au3 This example is not only moving animals around your screen but you can capture (stop) these animals by clicking with your left mouse button on it. You can drag and drop the animals around the screen before it pauses. Two scripts are still required. One for the Cheetah and one for the Tiger. Both scripts communicate with each other via memory pointers (Nomad's functions) Remember to download trancexx' GIFAnimation.au3 (see link above) Compiling: You can run the client script (or both scripts) compiled but change the setting $b_TigerWalk_au3 to False Also be aware that you can run the compiled script only in 32bit mode, it will work fine on a x64 system though. Both scripts should be in the same folder There are only 2 pointers that the apps share, one for holding each other and one to stop pausing randomly (animals will run continuously, change the $bNoPause setting in CheetahRun.au3, it should be to False but I left it to True for the sake of the demo. I modified some images, so if you ran the past demos, please first empty your temp folder with following script. #cs ---------------------------------------------------------------------------- Author: GreenCan Script Function: Cleanup temporary folder for CheetahRun #ce ---------------------------------------------------------------------------- Global $sTempFolder = @TempDir & "\GIFS" DirRemove($sTempFolder, 1) Let me know if you find any bug, I exhaustively tested both scripts but as it is rather complex to debug, you never know... GreenCan
- 16 replies