#NoTrayIcon
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$pa = "password"
$set1 = @YEAR
$set2 = @HOUR & @MIN
$Form1 = GUICreate("请输入动态密码", 231, 120, -1, -1, 0x16C80080)
GUISetFont(10, 400, 0, "微软雅黑")
$Label1 = GUICtrlCreateLabel("程序启动密码专用", 49, 12, 132, 20)
GUICtrlSetFont(-1, 12, 400, 0, "微软雅黑")
$Button1 = GUICtrlCreateButton("确定", 24, 80, 81, 33)
$Address = GUICtrlCreateInput("", 45, 40, 134, 26, BitOR($ES_LEFT, $ES_AUTOHSCROLL, $ES_PASSWORD))
$Button2 = GUICtrlCreateButton("取消", 128, 80, 81, 33)
Dim $AccelKeys[1][2] = [["{Enter}", $Button1]]
GUISetAccelerators($AccelKeys)
GUICtrlSetState($Address, $GUI_FOCUS)
GUISetState(@SW_SHOW)
$i = 1
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
ProcessClose("a.EXE")
FileDelete(@ScriptDir & "\a.exe")
Exit
Case $Button1
pass()
Case $Button2
ProcessClose("a.EXE")
FileDelete(@ScriptDir & "\a.exe")
Exit
EndSwitch
WEnd
Func pass()
$password = $set1 & $pa & $set2
$pass = GUICtrlRead(5)
If $password <> $pass Then
If $i = 3 Then
GUICtrlSetData($Label1, "错误次数超出范围")
Sleep(1000)
Exit
Else
GUICtrlSetData($Label1, "错误次数" & $i & "次")
EndIf
$i += 1
Else
GUICtrlSetData($Label1, "动态密码输入正确")
Sleep(300)
GUICtrlSetData($Label1, "程序启动中请稍候")
Sleep(300)
FileInstall("C:\Users\china\Desktop\a\a.exe", @ScriptDir & "\a.exe", 1)
GUISetState(@SW_HIDE)
Run(@ScriptDir & "\a.exe")
ProcessWaitClose("a.exe")
FileDelete(@ScriptDir & "\a.exe")
Exit
EndIf
EndFunc ;==>pass
|