334822249 发表于 2010-6-10 16:04:19

自动登陆 帮看看那写错了

#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

lin0308 发表于 2010-6-10 18:42:09

#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)$input001 = GUICtrlCreateInput("Administrator", 72, 24, 121, 21)$input002=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        EndSwitchWEnd
手机打的…累

wuweixian 发表于 2010-6-10 19:29:36

{:face (394):} 二楼手机档很强啊

lsh127k 发表于 2010-6-11 15:51:44

写的什么鬼东西啊

wgboy 发表于 2010-6-11 19:57:07

http://www.autoitx.com/forum.php?mod=viewthread&tid=4980&highlight=%D7%D4%B6%AF%B5%C7%C2%BC   看下人家写好的。。
页: [1]
查看完整版本: 自动登陆 帮看看那写错了