求助~求助~求助!
$reg = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"if RegRead($reg,"AutoAdminLogon") = 1 Then
$jx = MsgBox(32+4,"提示","你已经设置了自动登陆,请问还要继续设置吗?")
if $jx = 7 then exit
EndIf
$user = RegRead($reg,"DefaultUserName")
$PASS = RegRead($reg,"DefaultPassword")
$NAME = InputBox("自动登陆","请输入用户名:",$user,"",250,100)
if $user = "" Then
MsgBox(16,"提示","用户名不能为空!")
$PASSWORD = InputBox("自动登陆","请输入密码:",$PASS,"*",250,100)
RegWrite($reg,"DefaultUserName","REG_SZ",$NAME)
RegWrite($reg,"AutoAdminLogon","REG_SZ",1)
RegWrite($reg,"DefaultPassword","REG_SZ",$PASSWORD)
MsgBox(64,"提示","设置完成!")
EndIf
求助一个问题。上面的如果$user 输入了空的话,那么弹出提示, 用户名不能为空,然后确定了之后跳转到 请输入用户名那里($NAME),重新输入用户名! 在线等~~~~谢谢了! 利用循环。
$reg = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
If RegRead($reg, "AutoAdminLogon") = 1 Then
$jx = MsgBox(32 + 4, "提示", "你已经设置了自动登陆,请问还要继续设置吗?")
If $jx = 7 Then Exit
EndIf
Do
$user = RegRead($reg, "DefaultUserName")
$PASS = RegRead($reg, "DefaultPassword")
$NAME = InputBox("自动登陆", "请输入用户名:", $user, "", 250, 100)
If $NAME == "" Then
MsgBox(16, "提示", "用户名不能为空!")
ContinueLoop
EndIf
Until 1
$PASSWORD = InputBox("自动登陆", "请输入密码:", $PASS, "*", 250, 100)
RegWrite($reg, "DefaultUserName", "REG_SZ", $NAME)
RegWrite($reg, "AutoAdminLogon", "REG_SZ", 1)
RegWrite($reg, "DefaultPassword", "REG_SZ", $PASSWORD)
MsgBox(64, "提示", "设置完成!") 3# sensel
不行啊。输入为空,只提示 不能为空,之后就往下继续运行了!! 抱歉,没经过测试就回答了。2楼代码严重错误。
$reg = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
If RegRead($reg, "AutoAdminLogon") = 1 Then
$jx = MsgBox(32 + 4, "提示", "你已经设置了自动登陆,请问还要继续设置吗?")
If $jx = 7 Then Exit
EndIf
While 1
$user = RegRead($reg, "DefaultUserName")
$PASS = RegRead($reg, "DefaultPassword")
$NAME = InputBox("自动登陆", "请输入用户名:", $user, "", 250, 100)
If $NAME == "" Then
MsgBox(16, "提示", "用户名不能为空!")
Else
ExitLoop
EndIf
WEnd
$PASSWORD = InputBox("自动登陆", "请输入密码:", $PASS, "*", 250, 100)
RegWrite($reg, "DefaultUserName", "REG_SZ", $NAME)
RegWrite($reg, "AutoAdminLogon", "REG_SZ", 1)
RegWrite($reg, "DefaultPassword", "REG_SZ", $PASSWORD)
MsgBox(64, "提示", "设置完成!") 4楼的正解,多谢多谢了!
还有个问题是,去到 设置密码那里。点取消还是继续往下设置完成! 6# wmiisht
用户点击“取消”需要通过判断@error来作相应处理。根据InputBox函数说明,点击“取消”后返回的@error值为2,请再加入相关语句。
例:
$PASSWORD = InputBox("自动登陆", "请输入密码:", $PASS, "*", 250, 100)
If @error = 2 Then ...
页:
[1]