mr.underperson Posted May 28, 2006 Share Posted May 28, 2006 I'm old-fashioned, I use Win+L. -mu Link to comment Share on other sites More sharing options...
marfdaman Posted May 28, 2006 Share Posted May 28, 2006 I'm old-fashioned, I use Win+L.-muWell then why not get modern and use ctrl+L Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Link to comment Share on other sites More sharing options...
CWorks Posted August 15, 2006 Share Posted August 15, 2006 (edited) I'll put this back from whence it came with a few changes i made as a learning experience just removed some dupe code and a dlg box tray icon also changes when locked now well lets see what did i learn not to be so quick to remove stuff before knowing what it does also Select...Case...EndSelect, if then, while wend, if else and where to put the damn endif's oh i almost forgot about how to call and create a funtion haven't used ElseIf yet, maybe next time all it took was reading posts in the support forum (best place by far to look if stuck) and help file to get some examples btw i'm up to page 46 in support forum now go ahead and tell me how messed up my code is expandcollapse popup; ---------------------------------------------------------------------------- ; Screen Lock ; ; AutoIt Version: 3.2.0.1 ; Author: Hallman \ CWorks ; ; HotKeys ; F9 = Close program ; F10 = Change password ; F11 = Enable ScreenLock ; ; ---------------------------------------------------------------------------- #include <guiconstants.au3> #include <string.au3> Opt("TrayMenuMode",1) Dim $Atempts = 0 Dim $Lock = 0 Dim $PassInput = "" Dim $Label Dim $ScreenyWindow = "" Dim $PassWindow = "" $Show_Controls_Timer = TimerInit() $Controls_Shown = 0 $PassWord = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Andy\ScreenLock", "Password") If $PassWord <> "" Then $PassWord = _StringEncrypt(0, $PassWord, "4471") Else Pass() EndIf Lock() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE And $Lock = 0 Exit Case $msg = $PassInput If GUICtrlRead($PassInput) == $PassWord Then Lock() MsgBox(0, "Atempts", "An incorrect password was entered " & $Atempts & " time(s).") $Atempts = 0 Else $Atempts += 1 SplashMsg("Error", "Invalid Password", 220, 100) EndIf Case $msg = $GUI_EVENT_PRIMARYUP And $Lock = 1 GUISetState(@SW_SHOW, $PassWindow) $Controls_Shown = 1 $Show_Controls_Timer = TimerInit() EndSelect If TimerDiff($Show_Controls_Timer) > 10000 And $Controls_Shown = 1 Then GUISetState(@SW_HIDE, $PassWindow) $Controls_Shown = 0 EndIf If WinExists("Windows Task Manager") And $Lock = 1 Then WinClose("Windows Task Manager") WinKill("Windows Task Manager") EndIf If WinActive($ScreenyWindow) = 0 And WinActive($PassWindow) = 0 And $Lock = 1 Then WinActivate($ScreenyWindow) EndIf If Not BitAND(WinGetState($ScreenyWindow, ""), 2) = 1 And $Lock = 1 Then GUISetState(@SW_SHOW) EndIf If $Lock = 1 And WinExists($ScreenyWindow) = 0 Then $ScreenyWindow = GUICreate("", @DesktopWidth, @DesktopHeight, -2, -2, $WS_POPUPWINDOW, $WS_EX_TOOLWINDOW) GUISwitch($ScreenyWindow) WinSetTrans($ScreenyWindow, "", 1) GUISetState(@SW_SHOW, $ScreenyWindow) WinSetOnTop($ScreenyWindow, "", 1) WinSetOnTop($PassWindow, "", 1) EndIf WEnd Func Lock() If $Lock = 0 Then RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableTaskMgr", "REG_DWORD", 00000001) HotKeySet("{F9}") HotKeySet("{F10}") HotKeySet("{F11}") ; HotKeySet("^!p") ;Ctrl-Alt-p ; HotKeySet("^!l") ;Ctrl-Alt-l TraySetIcon("Shell32.dll", 47) $ScreenyWindow = GUICreate("", @DesktopWidth + 2, @DesktopHeight + 2, -2, -2, $WS_POPUPWINDOW, $WS_EX_TOOLWINDOW) GUISwitch($ScreenyWindow) WinSetTrans($ScreenyWindow, "", 1) Global $PassWindow = GUICreate("", 220, 80, -1, -1, $WS_POPUPWINDOW, $WS_EX_TOOLWINDOW) GUISwitch($PassWindow) GUISetState(@SW_HIDE) Global $Label = GUICtrlCreateLabel("The screen has been locked.", 10, 10, -1, 15) ; GUICtrlSetColor(-1,0xff0000) Global $PassInput = GUICtrlCreateInput("Password", 10, 30, 200, 20, $ES_PASSWORD) Global $Label2 = GUICtrlCreateLabel("Type Password and hit Enter", 10, 55, -1, 15) ; GUICtrlSetColor(-1,0xff0000) GUISetState(@SW_SHOW, $ScreenyWindow) WinSetOnTop($ScreenyWindow, "", 1) WinSetOnTop($PassWindow, "", 1) $Lock = 1 Else GUIDelete($ScreenyWindow) GUIDelete($PassWindow) HotKeySet("{F9}", "close") HotKeySet("{F10}", "Pass") HotKeySet("{F11}", "Lock") ; HotKeySet("^!p", "Pass") ;Ctrl-Alt-p ; HotKeySet("^!l", "Lock") ;Ctrl-Alt-l TraySetIcon("Shell32.dll", 44) RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableTaskMgr", "REG_DWORD", 00000000) $Lock = 0 EndIf EndFunc ;==>Lock Func Pass() $PassWord = InputBox("Create Password", "Enter your password", "", "", 100, 100) If $PassWord = "" Then MsgBox(16, "error", "Invalid password.") Pass() Else RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Andy\ScreenLock", "Password", "REG_SZ", _StringEncrypt(1, $PassWord, "4471")) EndIf EndFunc ;==>Pass Func SplashMsg($S_Title = "", $S_Text = "", $S_Size_X = 300, $S_Size_Y = 300) SplashTextOn($S_Title, $S_Text & @CRLF & "Press Enter to close this window.", $S_Size_X, $S_Size_Y) HotKeySet("{ENTER}", "OffSplash") EndFunc ;==>SplashMsg Func OffSplash() SplashOff() HotKeySet("{ENTER}") EndFunc ;==>OffSplash Func close() Exit EndFunc ;==>close Edited August 15, 2006 by CWorks Link to comment Share on other sites More sharing options...
orange Posted August 18, 2006 Share Posted August 18, 2006 (edited) Edit -- Posted in wrong forum. Edited August 19, 2006 by orange Link to comment Share on other sites More sharing options...
Hein88 Posted August 19, 2006 Share Posted August 19, 2006 Very nice piece of code I was wondering if it is possible to get all windows minimized before the screenshot.. And maybe there is also a possibility to leave those desktopicons out on the screenshot regards. Link to comment Share on other sites More sharing options...
CWorks Posted August 19, 2006 Share Posted August 19, 2006 (edited) decided to add a choice of writing password to registry or ScreenLock.iniScreenLock.ini is the default choiceHotKeys available while unlockedF9 = Close programF10 = Change passwordF11 = Enable ScreenLockScreenLock.au3 Edited August 19, 2006 by CWorks Link to comment Share on other sites More sharing options...
dandymcgee Posted August 20, 2006 Share Posted August 20, 2006 (edited) Wow dude nice program. Looks just like I walked away from my computer until someone tries to click it. EDIT: Typo Edited August 20, 2006 by dandymcgee - Dan [Website] Link to comment Share on other sites More sharing options...
CWorks Posted August 22, 2006 Share Posted August 22, 2006 @Hein88 it's not a screenshot just a transparent gui and while looking fo something else i found how to minimize all windows just add this to lock function and all windows are minimized $oShell = ObjCreate("shell.application") $oShell.MinimizeAll Link to comment Share on other sites More sharing options...
Vindicator209 Posted August 27, 2006 Share Posted August 27, 2006 Very nice work, but i suggest closing explorer.exe and run it again when it is unlocked, because i tried pressing the WIN key a couple of times and wouldnt let me unlock it, it just froze and wouldnt let me press the unlock button.. hehe, minor flaw, but can be fixed if you have a hibernation button on your keyboard, also another minor flaw ^^ its VERY cool though, i had made a lock once, it was a splash text on that was too big for teh screen and invis. which could only be exited with hotkeys, but yours beats mine big time... [center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center] Link to comment Share on other sites More sharing options...
AutoDave Posted October 27, 2008 Share Posted October 27, 2008 This is a nice script! Works very well on XP, but on Vista the "Startmenu button" is actually visible (on top of the lock window) and can be used. Thanks, Dave KeeForm 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