|
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=f:\新建文件夹\新建文件夹 (2)\自动登陆.kxf
$Form1_1 = GUICreate("自动登陆", 211, 145, 427, 223)
$Label1 = GUICtrlCreateLabel("用户名:", 16, 24, 52, 17)
$Label2 = GUICtrlCreateLabel("密码:", 16, 64, 40, 17)
$Administrator = GUICtrlCreateInput("Administrator", 72, 24, 121, 21)
GUICtrlCreateInput("", 72, 64, 121, 21)
$Button1 = GUICtrlCreateButton("设置自动登陆", 16, 104, 83, 25)
$Button2 = GUICtrlCreateButton("取消自动登陆", 112, 104, 83, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $nMsg = $Button23
GUISetState(@SW_SHOW, $WinSub1)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button002
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "AutoAdminLogon", "REG_SZ", 0)
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultPassword", "REG_SZ", "")
MsgBox(0, "已取消自动登陆,重启计算机生效", 2)
Case $Button001
$username = GUICtrlRead($Input001)
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "AutoAdminLogon", "REG_SZ", 1)
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultUserName", "REG_SZ", $username)
$password = GUICtrlRead($Input002)
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultPassword", "REG_SZ", $password)
MsgBox(0, "设置成功,重启计算机生效", 2)
ExitLoop
EndSwitch
WEnd
Case $nMs
EndSwitch
WEnd |
|