找回密码
 加入
搜索
查看: 2925|回复: 2

[AU3基础] [已解决]密码修改为空或错误 返回 输密码界面

[复制链接]
发表于 2015-1-16 15:37:24 | 显示全部楼层 |阅读模式
本帖最后由 mshuking 于 2015-1-17 11:31 编辑

密码修改为空或错误  返回  输密码界面 怎么写?   已修改
$pwdreg = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\regpwd","password")
If $pwdreg = "" Then
                $adminpwd = InputBox("密码设置", "请设置新密码:", "", "*",200,120)
                If $adminpwd = "" Then Exit MsgBox(64, "提示", "密码不能为空")
                If $adminpwd <> "" Then RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\regpwd","password","REG_SZ",$adminpwd)
                MsgBox(64, "提示", "密码设置成功")
EndIf
$input=InputBox("密码测试", "请输入管理密码:", "", "*",200,120) 
If $pwdreg <> $input Then Exit MsgBox(48, "提示", "密码错误 ")
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("密码测试 ", 200, 120)
$Button1 = GUICtrlCreateButton("修改密码", 16, 16, 120, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
        $nMsg = GUIGetMsg()
        Sleep(50)
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        $admin = InputBox("修改密码", "请输入新密码:", "", "*",200,120)
                        If $admin = "" Then ExitLoop MsgBox(64, "提示", "密码不能为空")
                        If $admin <> "" Then MsgBox(64, "提示", "密码修改成功")
                        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\regpwd","password","REG_SZ",$admin)
        EndSwitch
WEnd
修改后
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$pwdreg = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\regpwd","password")
If $pwdreg = "" Then
While 1
        $admin = InputBox("设置密码", "第一次使用请设置密码:", "", "*",200,120)
   If  $admin = "" Then 
         MsgBox(64, "提示", "密码不能为空")
   Else
         ExitLoop
   EndIf
WEnd
If $admin <> "" Then MsgBox(64, "提示", "密码设置成功,请重新运行!")
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\regpwd","password","REG_SZ",$admin)
Exit
EndIf
While 2
        $input = InputBox("密码测试", "请输入管理密码:", "", "*", 200, 120)
        If $pwdreg <> $input Then
                 MsgBox(48, "提示", "密码错误,请重新输入.")
        Else
                 ExitLoop
        EndIf
WEnd
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("密码测试 ", 200, 120)
$Button1 = GUICtrlCreateButton("修改密码", 16, 16, 120, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 3
        $nMsg = GUIGetMsg()
        Sleep(50)
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                       _pwd()
        EndSwitch
        WEnd
Func _pwd()
While 3
        $admin = InputBox("修改密码", "请输入新密码:", "", "*",200,120)
   If $admin = "" Then 
         MsgBox(64, "提示", "密码不能为空")
   Else
         ExitLoop
   EndIf
WEnd
If $admin <> "" Then MsgBox(64, "提示", "密码修改成功")
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\regpwd","password","REG_SZ",$admin)
EndFunc
发表于 2015-1-16 23:02:04 | 显示全部楼层
While 1
        $input = InputBox("密码测试", "请输入管理密码:", "", "*", 200, 120)
        If $pwdreg <> $input Then
                MsgBox(48, "提示", "密码错误,请重新输入.")
        Else
                ExitLoop
        EndIf
WEnd
 楼主| 发表于 2015-1-17 11:13:45 | 显示全部楼层
回复 2# zhouhaijin


    谢谢提示
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-12-28 03:52 , Processed in 0.070678 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表