Jump to content

stuck on adding a password


Recommended Posts

ive been trying to get this to work for a while now im fine with the code how it is if i could get the password thing to work then i could move on but i cant get it to work :) can someone see whats wrong with it?

#include <GUIConstants.au3>
#include <String.au3>

$Form1 = GUICreate("Desktop Lock", 153, 214, -1, -1, BitOR($WS_MINIMIZEBOX,$WS_SYSMENU,$WS_CAPTION,$WS_POPUPWINDOW,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS,$DS_CONTEXTHELP), BitOR($WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE))
GUISetBkColor(0x000000)
$Inputpass = GUICtrlCreateInput("", 8, 19, 137, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
GUICtrlSetBkColor(-1, 0x008000)
$Label1 = GUICtrlCreateLabel("Password to unlock Desktop", 8, 0, 140, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Button1 = GUICtrlCreateButton("Lock", 9, 48, 59, 25, 0)
GUICtrlSetTip(-1, "Lock Your Desktop Now")
$Button2 = GUICtrlCreateButton("Exit", 85, 48, 59, 25, 0)
GUICtrlSetTip(-1, "Exit Program w/o locking it")
$Group1 = GUICtrlCreateGroup("", 8, 80, 137, 105)
GUICtrlSetBkColor(-1, 0x000000)
$Label2 = GUICtrlCreateLabel("Desktop will be unlocked", 16, 88, 123, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Label3 = GUICtrlCreateLabel("if the computer is restarted", 13, 104, 128, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Label4 = GUICtrlCreateLabel("click button below to ", 24, 120, 105, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Label5 = GUICtrlCreateLabel("Keep locked", 40, 136, 64, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Button3 = GUICtrlCreateButton("!", 26, 152, 99, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "@DFKai-SB")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$MenuItem2 = GUICtrlCreateMenu("&Help")
$MenuItem1 = GUICtrlCreateMenuItem("About", $MenuItem2)
$MenuItem3 = GUICtrlCreateMenu("How to", $MenuItem2)
$MenuItem4 = GUICtrlCreateMenuItem("How to", $MenuItem3)
$MenuItem5 = GUICtrlCreateMenuItem("Not Working?", $MenuItem3)
GUISetState(@SW_SHOW)

$Form2 = GUICreate("", 121, 193, -1, -1, BitOR($WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE))
GUISetBkColor(0x000000)
$Group1 = GUICtrlCreateGroup("", 7, 0, 105, 163)
GUICtrlSetBkColor(-1, 0x000000)
$Label1 = GUICtrlCreateLabel("TO UNLOCK", 16, 8, 89, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Label5 = GUICtrlCreateLabel("PRESS THE", 16, 28, 90, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Label4 = GUICtrlCreateLabel("KEY", 43, 102, 33, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Button3 = GUICtrlCreateButton("OK", 22, 125, 75, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Pause", 37, 47, 57, 28)
GUICtrlSetFont(-1, 15, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Label3 = GUICtrlCreateLabel("Break", 39, 70, 52, 28)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
GUICtrlCreateGroup("", -99, -99, 1, 1)




$Form3 = GUICreate("", 138, 90, -1, -1)
GUISetBkColor(0x000000)
$Label1 = GUICtrlCreateLabel("Password?", 40, 7, 56, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Inputpassword = GUICtrlCreateInput("", 8, 24, 121, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
GUICtrlSetBkColor(-1, 0x008000)
$Button4 = GUICtrlCreateButton("OK", 8, 56, 51, 25, 0)
$Button5 = GUICtrlCreateButton("Exit", 80, 56, 51, 25, 0)

$about = GUICreate("About", 322, 194, 543, 236,BitOR($WS_POPUP, $WS_DLGFRAME),$WS_EX_TOOLWINDOW)
GUISetIcon("D:\006.ico")
GUISetBkColor(0x000000)
$GroupBox1 = GUICtrlCreateGroup("", 8, 8, 305, 177)
GUICtrlSetBkColor(-1, 0x000000)
$Image1 = GUICtrlCreatePic("", 16, 24, 105, 97, BitOR($SS_NOTIFY,$WS_GROUP))
$Label1 = GUICtrlCreateLabel("Product Name: Desktop Lock", 143, 24, 145, 17, $WS_GROUP)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Label2 = GUICtrlCreateLabel("Version: 1.0", 143, 48, 60, 17, $WS_GROUP)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Label1 = GUICtrlCreateLabel("Date Released: 11/32/07", 143, 75, 127, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Label2 = GUICtrlCreateLabel("BDP.I8.COM", 144, 104, 65, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Button6 = GUICtrlCreateButton("OK", 134, 144, 75, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)




$howto = GUICreate("How to", 124, 122, -1, -1,BitOR($WS_POPUP, $WS_DLGFRAME),$WS_EX_TOOLWINDOW)
GUISetBkColor(0x000000)
$Label1 = GUICtrlCreateLabel("How to", 17, 5, 92, 36)
GUICtrlSetFont(-1, 20, 800, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Group1 = GUICtrlCreateGroup("", 9, 35, 105, 49)
GUICtrlSetBkColor(-1, 0x000000)
$Label2 = GUICtrlCreateLabel("Type in a password", 14, 45, 96, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Label3 = GUICtrlCreateLabel("Click Lock button", 18, 63, 87, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button7 = GUICtrlCreateButton("OK", 23, 88, 75, 25, 0)





While 1
    $msg = GUIGetMsg()
    HotKeySet ("{pause}", "showpass")
    Select
    Case $msg = $button1
            $pw = $inputpass
    IniWrite (@desktopDir & "\pdb.ini", "data", "0", $pw)
        GUISetState(@sw_hide, $Form1)
        GUISetState(@sw_show, $Form2)
    Case $msg = $Button2
        ExitLoop
    Case $msg = $button3
        GUISetState(@sw_hide, $form2)
    Case $msg = $button4
        _Plock()
    Case $msg = $button5
        GUISetState(@sw_hide, $form3)
    Case $msg = $button6
        GUISetState(@sw_hide, $about)
    Case $msg = $button7
        GUISetState(@sw_hide, $howto)
    Case $msg = $menuitem1
        GUISetState(@sw_show, $about)
    Case $msg = $menuitem4
        GUISetState(@sw_show, $howto)
    EndSelect
   If $msg = $GUI_EVENT_CLOSE Then ExitLoop
       
   Wend

Func showpass ()
    ConsoleWrite("> form3 = shown" & @crlf)
    GUISetState(@sw_show, $form3)
EndFunc 

    
    
Func _PLock()
    asdf()
    $input = $inputpassword
    If $input = $pw Then
        MsgBox (0, "Error", "Access Granted", 4)
        FileDelete (@desktopDir & "\pdb.ini")
        Exit
    Else
        MsgBox (0, "Error", "Access Denied", 4)
        _plock()
    EndIf
EndFunc   ;==>_PLock
Link to comment
Share on other sites

ive been trying to get this to work for a while now im fine with the code how it is if i could get the password thing to work then i could move on but i cant get it to work :) can someone see whats wrong with it?

#include <GUIConstants.au3>
#include <String.au3>

$Form1 = GUICreate("Desktop Lock", 153, 214, -1, -1, BitOR($WS_MINIMIZEBOX,$WS_SYSMENU,$WS_CAPTION,$WS_POPUPWINDOW,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS,$DS_CONTEXTHELP), BitOR($WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE))
GUISetBkColor(0x000000)
$Inputpass = GUICtrlCreateInput("", 8, 19, 137, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
GUICtrlSetBkColor(-1, 0x008000)
$Label1 = GUICtrlCreateLabel("Password to unlock Desktop", 8, 0, 140, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Button1 = GUICtrlCreateButton("Lock", 9, 48, 59, 25, 0)
GUICtrlSetTip(-1, "Lock Your Desktop Now")
$Button2 = GUICtrlCreateButton("Exit", 85, 48, 59, 25, 0)
GUICtrlSetTip(-1, "Exit Program w/o locking it")
$Group1 = GUICtrlCreateGroup("", 8, 80, 137, 105)
GUICtrlSetBkColor(-1, 0x000000)
$Label2 = GUICtrlCreateLabel("Desktop will be unlocked", 16, 88, 123, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Label3 = GUICtrlCreateLabel("if the computer is restarted", 13, 104, 128, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Label4 = GUICtrlCreateLabel("click button below to ", 24, 120, 105, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Label5 = GUICtrlCreateLabel("Keep locked", 40, 136, 64, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Button3 = GUICtrlCreateButton("!", 26, 152, 99, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "@DFKai-SB")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$MenuItem2 = GUICtrlCreateMenu("&Help")
$MenuItem1 = GUICtrlCreateMenuItem("About", $MenuItem2)
$MenuItem3 = GUICtrlCreateMenu("How to", $MenuItem2)
$MenuItem4 = GUICtrlCreateMenuItem("How to", $MenuItem3)
$MenuItem5 = GUICtrlCreateMenuItem("Not Working?", $MenuItem3)
GUISetState(@SW_SHOW)

$Form2 = GUICreate("", 121, 193, -1, -1, BitOR($WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE))
GUISetBkColor(0x000000)
$Group1 = GUICtrlCreateGroup("", 7, 0, 105, 163)
GUICtrlSetBkColor(-1, 0x000000)
$Label1 = GUICtrlCreateLabel("TO UNLOCK", 16, 8, 89, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Label5 = GUICtrlCreateLabel("PRESS THE", 16, 28, 90, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Label4 = GUICtrlCreateLabel("KEY", 43, 102, 33, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Button3 = GUICtrlCreateButton("OK", 22, 125, 75, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Pause", 37, 47, 57, 28)
GUICtrlSetFont(-1, 15, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Label3 = GUICtrlCreateLabel("Break", 39, 70, 52, 28)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
GUICtrlCreateGroup("", -99, -99, 1, 1)




$Form3 = GUICreate("", 138, 90, -1, -1)
GUISetBkColor(0x000000)
$Label1 = GUICtrlCreateLabel("Password?", 40, 7, 56, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Inputpassword = GUICtrlCreateInput("", 8, 24, 121, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
GUICtrlSetBkColor(-1, 0x008000)
$Button4 = GUICtrlCreateButton("OK", 8, 56, 51, 25, 0)
$Button5 = GUICtrlCreateButton("Exit", 80, 56, 51, 25, 0)

$about = GUICreate("About", 322, 194, 543, 236,BitOR($WS_POPUP, $WS_DLGFRAME),$WS_EX_TOOLWINDOW)
GUISetIcon("D:\006.ico")
GUISetBkColor(0x000000)
$GroupBox1 = GUICtrlCreateGroup("", 8, 8, 305, 177)
GUICtrlSetBkColor(-1, 0x000000)
$Image1 = GUICtrlCreatePic("", 16, 24, 105, 97, BitOR($SS_NOTIFY,$WS_GROUP))
$Label1 = GUICtrlCreateLabel("Product Name: Desktop Lock", 143, 24, 145, 17, $WS_GROUP)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Label2 = GUICtrlCreateLabel("Version: 1.0", 143, 48, 60, 17, $WS_GROUP)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Label1 = GUICtrlCreateLabel("Date Released: 11/32/07", 143, 75, 127, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Label2 = GUICtrlCreateLabel("BDP.I8.COM", 144, 104, 65, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Button6 = GUICtrlCreateButton("OK", 134, 144, 75, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)




$howto = GUICreate("How to", 124, 122, -1, -1,BitOR($WS_POPUP, $WS_DLGFRAME),$WS_EX_TOOLWINDOW)
GUISetBkColor(0x000000)
$Label1 = GUICtrlCreateLabel("How to", 17, 5, 92, 36)
GUICtrlSetFont(-1, 20, 800, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Group1 = GUICtrlCreateGroup("", 9, 35, 105, 49)
GUICtrlSetBkColor(-1, 0x000000)
$Label2 = GUICtrlCreateLabel("Type in a password", 14, 45, 96, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Label3 = GUICtrlCreateLabel("Click Lock button", 18, 63, 87, 17)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button7 = GUICtrlCreateButton("OK", 23, 88, 75, 25, 0)





While 1
    $msg = GUIGetMsg()
    HotKeySet ("{pause}", "showpass")
    Select
    Case $msg = $button1
            $pw = $inputpass
    IniWrite (@desktopDir & "\pdb.ini", "data", "0", $pw)
        GUISetState(@sw_hide, $Form1)
        GUISetState(@sw_show, $Form2)
    Case $msg = $Button2
        ExitLoop
    Case $msg = $button3
        GUISetState(@sw_hide, $form2)
    Case $msg = $button4
        _Plock()
    Case $msg = $button5
        GUISetState(@sw_hide, $form3)
    Case $msg = $button6
        GUISetState(@sw_hide, $about)
    Case $msg = $button7
        GUISetState(@sw_hide, $howto)
    Case $msg = $menuitem1
        GUISetState(@sw_show, $about)
    Case $msg = $menuitem4
        GUISetState(@sw_show, $howto)
    EndSelect
   If $msg = $GUI_EVENT_CLOSE Then ExitLoop
       
   Wend

Func showpass ()
    ConsoleWrite("> form3 = shown" & @crlf)
    GUISetState(@sw_show, $form3)
EndFunc 

    
    
Func _PLock()
    asdf()
    $input = $inputpassword
    If $input = $pw Then
        MsgBox (0, "Error", "Access Granted", 4)
        FileDelete (@desktopDir & "\pdb.ini")
        Exit
    Else
        MsgBox (0, "Error", "Access Denied", 4)
        _plock()
    EndIf
EndFunc   ;==>_PLock
$pw = GUICtrlRead($inputpass)

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...