#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
Dim $Button[5], $mima
$mima = RegRead("HKEY_CURRENT_USER\Software\登陆","密码")
$Form1 = GUICreate("登陆", 231, 160, -1,-1)
$Input1_1 = GUICtrlCreateInput("", 64, 45, 121, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD))
$Label1_2 = GUICtrlCreateLabel("密码:", 24, 48, 40, 17)
$Button[1] = GUICtrlCreateButton("登陆", 24, 112, 75, 25)
$Button[2] = GUICtrlCreateButton("修改密码", 128, 112, 75, 25)
$Form2 = GUICreate("密码修改", 240, 159, -1,-1)
$Input2_1 = GUICtrlCreateInput("", 72, 16, 121, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD))
$Input2_2 = GUICtrlCreateInput("", 72, 48, 121, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD))
$Input2_3 = GUICtrlCreateInput("", 72, 88, 121, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD))
$Label2_1 = GUICtrlCreateLabel("旧密码:", 16, 16, 52, 17)
$Label2_2 = GUICtrlCreateLabel("新密码:", 16, 48, 52, 17)
$Label2_3 = GUICtrlCreateLabel("新密码:", 16, 88, 44, 17)
$Button[3] = GUICtrlCreateButton("保存", 24, 120, 75, 25)
$Button[4] = GUICtrlCreateButton("取消", 136, 120, 75, 25)
TraySetState()
GUISwitch($Form1)
GUISetState(@SW_SHOW)
For $I = 4 To 0 Step -1
GUICtrlSetOnEvent($Button[$I],"GUIGetMsg")
Next
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button[1]
$du=GUICtrlRead($Input1_1)
If $du=$mima Then
MsgBox(0,"","登陆成功!")
Else
MsgBox(0,"","密码错误!")
EndIf
Case $Button[2]
GUISetState(@SW_SHOW,$Form2)
Case $Button[3]
$du1=GUICtrlRead($Input2_1)
$du2=GUICtrlRead($Input2_2)
$du3=GUICtrlRead($Input2_3)
If $du1<>$mima Then
MsgBox(0,"","旧密码不正确!")
ElseIf $du3<>$du2 Then
MsgBox(0,"","新密码两次输入不一样!")
Else
RegWrite("HKEY_CURRENT_USER\Software\登陆","密码","REG_SZ",$du2)
MsgBox(0,"","密码修改成功!")
EndIf
Case $Button[4]
GUISetState(@SW_HIDE,$Form2)
EndSwitch
WEnd