mshuking 发表于 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

zhouhaijin 发表于 2015-1-16 23:02:04

While 1
        $input = InputBox("密码测试", "请输入管理密码:", "", "*", 200, 120)
        If $pwdreg <> $input Then
                MsgBox(48, "提示", "密码错误,请重新输入.")
        Else
                ExitLoop
        EndIf
WEnd

mshuking 发表于 2015-1-17 11:13:45

回复 2# zhouhaijin


    谢谢提示
页: [1]
查看完整版本: [已解决]密码修改为空或错误 返回 输密码界面