Jump to content

thudo

Member
  • Posts

    1
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    Canada

About thudo

Profile Information

  • OS
    XP Home

thudo's Achievements

0

Reputation

  1. Have some Autoit Code I seriously need addressing With the help of others I've created this: #include <Misc.au3> Opt('GUIOnEventMode', 1) #Region Pref GUI $PGUI = GUICreate('Login', 170, 110, -1, -1, BitOR(0x00040000, 0x00000080)) GUISetOnEvent(-3, '_PrefClose') GUICtrlCreateGroup('Enter Password', 5, 10, 155, 40) $password = GUICtrlCreateInput("", 10, 25, 145, 20, 0x0020) ; $ES_PASSWORD style <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< GUICtrlCreateButton('Apply', 55, 55, 50, 20) GUICtrlSetOnEvent(-1, '_PrefClose') GUISetState(@SW_HIDE, $PGUI) #EndRegion Pref GUI ; Always run the application _PrefOpen() Func _MouseTrapCurrent($hWin) If WinExists($hWin) Then $Pos = WinGetPos($hWin) If Not @error Then _MouseTrap($Pos[0], $Pos[1], $Pos[0] + $Pos[2], $Pos[1] + $Pos[3]) EndIf Else _MouseTrap() Endif EndFunc While 1 _MouseTrapCurrent('Login') WEnd Func _PrefOpen() GUISetState(@SW_SHOW, $PGUI) EndFunc ;==>_PrefOpen Func _PrefClose() Exit GUISetState(@SW_HIDE, $PGUI) EndFunc ;==>_PrefClose #EndRegion Pref Func While 1 Sleep(10) WEnd Which basically freezes the mouse into the password box perfectly as it should. However.. I cannot get it to work within this: Func _PasswordOpen() $PASSGUI = GUICreate('Login', 170, 110, -1, -1, BitOR(0x00040000, 0x00000080)) GUISetOnEvent(-3, '_PasswordClose') GUICtrlCreateGroup('Enter Password', 5, 10, 155, 40) Global $password = GUICtrlCreateInput("", 10, 25, 145, 20, 0x0020) ; $ES_PASSWORD style <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< GUICtrlCreateButton('OK', 55, 55, 50, 20) GUICtrlSetOnEvent(-1, '_PasswordCheck') GUISetState(@SW_HIDE, $PASSGUI) GUISetState(@SW_SHOW, $PASSGUI) EndFunc ;==>_PasswordOpen Func _MouseTrapCurrent($hWin) If WinExists($hWin) Then $Pos = WinGetPos($hWin) If Not @error Then _MouseTrap($Pos[0], $Pos[1], $Pos[0] + $Pos[2], $Pos[1] + $Pos[3]) EndIf Else _MouseTrap() Endif EndFunc While 1 _MouseTrapCurrent('Login') WEnd Switch _PasswordCheck() Case 1 MsgBox(0, "Result", "Login Correct") Case 0 MsgBox(0, "Result", "Login Cancelled ") case -1 MsgBox(0, "Result", "Failed 5 times lock out user") EndSwitch Func _PasswordCheck() Local $iXTimes = 5, $iCount = 1 While 1 _PasswordOpen() Local $bPasswordHash=(FileReadLine($sav, 5)) Local $bMasterPasswordHash=(FileReadLine($sav, 6)) $sPassWord = GUICtrlRead($password) If _Crypt_HashData($sPassword,$CALG_MD5)=$bPasswordHash or _Crypt_HashData($sPassword,$CALG_MD5)=$bMasterPasswordHash Then Return $sPassword Select Case $sPassword = "Correct" Return 1 Case $iCount = $iXTimes BlockInput(1) ; Freeze user's mouse/keyboard -- likely will omit this but here for testing the lock down. MsgBox(16, "Failed Password Login attempt limit reached", "Please contact your local Associate or Front Store Manager for Assistance..") Return -1 Case Else MsgBox(16, "Access Denied", "Password Incorrect!" & @CR & "You have " & $iXTimes - $iCount & " trys left") $iCount += 1 EndSelect WEnd EndFunc ;==>_PasswordCheckThe Login GUI box is essentially conflicting with the PasswordCheck function by not working together AND also NOT freezing the mouse in the Login box as in the first code example. I'm also there just need some help merging both code bits together. The key was using a GUI rather than an InputBox which should then properly hold the mouse in place. This all has to work within the greater project. If you want I can post the entire code. Its meant for a screensaver we're working on which simulates Windows Authentication via AD (which is turned off in the environment I work in). Thanks MSFN team!
×
×
  • Create New...