Sign in to follow this  
Followers 0
sandin

blocking windows/alt/ctrl+alt+del/function keys (?)

3 posts in this topic

Hi, I have this code so far:

#include <GUIConstants.au3>
#Include <Constants.au3>
#include <string.au3>
#NoTrayIcon
$font="Arial"
global $form2, $lavel1, $label2, $input, $form1, $form4, $i = 0,$input4,$label5, $label6, $input3, $input4,$button_ok, $input2, $label4
Opt("TrayMenuMode", 1)
Opt("TrayOnEventMode",1)
Opt("GUIOnEventMode", 1)
$InputPass = "snd"
$InputLevel = 1
if RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\snd\desktoplocker\", "Encripted Password")="" then
    $password = ""
Else
    $string1 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\snd\desktoplocker\", "Encripted Password")
    $password = _StringEncrypt(0,$string1,$InputPass,$InputLevel)
EndIf

TraySetIcon(@SystemDir & "\SHELL32.dll", 44)
$lock = TrayCreateItem("Lock desktop")
TrayItemSetState(-1, 512)
$changepassword = TrayCreateItem("Change password")
TrayCreateItem("")
$ExitItem = TrayCreateItem("Exit")

TrayItemSetOnEvent($lock, "zakljucaj")
TrayItemSetOnEvent($changepassword, "menjajpass")
TrayItemSetOnEvent($ExitItem, "izlaz")

TraySetState()
TraySetToolTip("Desktop Locker")
TrayTip("Desktop Locker", "Click here to lock desktop," & @CRLF & "change password or exit.", 3)

AdlibEnable ("adlib1", 250)

func menjajpass ()
    $i = 1
    $form4 = Guicreate("Change password", 300, 205, Default, Default, $WS_POPUPWINDOW)
    GuiSetIcon(@SystemDir & "\SHELL32.dll", 44)
    GUISetFont (9, 800, Default, $font)
    $label4 = GUICtrlCreateLabel("Please type in your old password:", 50, 10, 260, 20)
    $input2 = GUICtrlCreateInput("", 20, 35, 260, 20, 0x21)
    $label5 = GUICtrlCreateLabel("Please type in your new password:", 50, 65, 260, 20)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $input3 = GUICtrlCreateInput("", 20, 90, 260, 20, 0x21)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $label6 = GUICtrlCreateLabel("Please confirm your new password:", 50, 120, 260, 20)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $input4 = GUICtrlCreateInput("", 20, 145, 260, 20, 0x21)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $button_ok = GUICtrlCreateButton("OK", 40, 175, 100, 20)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $button_cancel = GUICtrlCreateButton("Cancel", 160, 175, 100, 20)
    GUICtrlSetOnEvent($button_ok, "potvrdi")
    GUICtrlSetOnEvent($button_cancel, "prekini")
    GUISetState(@SW_SHOW)
EndFunc

func prekini ()
    GUIDelete($Form4)
    $i = 0
EndFunc

Func potvrdi ()
    $password = guictrlread($input4)
    $string2 = _StringEncrypt(1,$password,$InputPass,$InputLevel)
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\snd\desktoplocker\", "Encripted Password", "REG_SZ", $string2)
    GUIDelete($Form4)
    $i = 0
EndFunc

func adlib1 ()
    if $i = 1 Then
        if GUICtrlRead($input2) = $password Then call("jebiga")
    EndIf
    if $i = 2 Then
        if guictrlread($input3) = guictrlread($input4) Then
            GUICtrlSetState($button_ok, $GUI_ENABLE)
        Else
            GUICtrlSetState($button_ok, $GUI_DISABLE)
        EndIf
    EndIf
EndFunc

func jebiga ()
    GUICtrlSetState($label4, $GUI_DISABLE)
    GUICtrlSetState($input2, $GUI_DISABLE)
    GUICtrlSetState($label5, $GUI_ENABLE)
    GUICtrlSetState($label6, $GUI_ENABLE)
    GUICtrlSetState($input3, $GUI_ENABLE)
    GUICtrlSetState($input4, $GUI_ENABLE)
    ControlFocus("Change password", "", $input3)
    $i = 2
EndFunc

func zakljucaj ()
    hotKeySet("{ENTER}", "Provera")
    $Form1 = GUICreate("pozadina", 2000, 2000, -50, -50)
    GuiSetIcon(@SystemDir & "\SHELL32.dll", 44)
    GUISetState(@SW_SHOW)
    WinSetTrans("pozadina", "", 200)
    
    $form2 = Guicreate("Type security password", 300, 150, Default, Default, $WS_POPUPWINDOW)
    GuiSetIcon(@SystemDir & "\SHELL32.dll", 44)
    GUISetFont (9, 800, Default, $font)
    $label1 = GUICtrlCreateLabel("Please type in your password:", 60, 25, 260, 20)
    GUISetFont (9, 800, Default, $font)
    $label2 = GUICtrlCreateLabel("", 50, 100, 260, 20)
    GUICtrlSetColor(-1, 0xff0000)
    $input = GUICtrlCreateInput("", 20, 60, 260, 20, 0x21)
    GUISetState(@SW_SHOW)
    WinSetOnTop("Type security password", "", 1)
EndFunc

While 1
    Sleep(10)
WEnd

func Izlaz ()
    Exit
EndFunc

func Provera ()
    if guictrlread($input) = $password Then
        call("otkljucano")
    Else
        GUICtrlSetData($label2, " Wrong password, please try again")
        GUICtrlSetData($input, "")
    EndIf
EndFunc

func otkljucano ()
    hotKeySet("{ENTER}")
    GUIDelete($form1)
    GUIDelete($form2)
    $form3 = Guicreate("Success", 300, 50, Default, Default, $WS_POPUPWINDOW)
    GuiSetIcon(@SystemDir & "\SHELL32.dll", 44)
    GUICtrlSetBkColor($form3, 0xf0fff0)
    GUISetFont (10, 800, Default, $font)
    $label3 = GUICtrlCreateLabel("Succes! You have unlocked your desktop", 20, 15, 290, 20)
    GUICtrlSetColor(-1, 0x698b22)
    GUISetState(@SW_SHOW)
    sleep(2000)
    GUIDelete($form3)
EndFunc

my prob. is that I can't figure out how to lock theese keys: ALT, TAB (couse ALT+TAB can switch windows), Windows key (couse you can use Win+D as "show desktop"), CTRL+ALT+DEL (couse then you can switch windows, and shutdown this prog.). I know it's easier to press Win+L and setup a password as a protection, but that's not fun, it's more fun when you make your own prog, but I can't figure this out. If I set blockinput it will block all keys, so I can't input any password. T_T help(?)

Share this post


Link to post
Share on other sites



Sounds like Group Policy might offer a better solution.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0