找回密码
 加入
搜索
查看: 5920|回复: 7

[原创] AD管理之账号解锁重置

  [复制链接]
发表于 2011-5-16 23:06:33 | 显示全部楼层 |阅读模式
本帖最后由 502762378 于 2011-5-17 00:03 编辑

公司中了个什么病毒,总是把账号搞成锁定,于是写了个账号解锁重置的东西,也希望帮到其他人,没什么技术含量,直接上码
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <AD.au3>
_AD_Open()
#Region ### 
$Form1 = GUICreate("AD账号解锁重置", 410, 220, 363, 185, $WS_SYSMENU)
$Input1 = GUICtrlCreateInput("", 152, 40, 113, 24);3
$Label1 = GUICtrlCreateLabel("请输入工号", 32, 40, 84, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("确定", 304, 40, 57, 25)
$Label2 = GUICtrlCreateLabel("工号锁定情况", 32, 88, 100, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Checkbox1 = GUICtrlCreateCheckbox("账户已锁定", 152, 80, 113, 33)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlSetState(-1,128)
$Button2 = GUICtrlCreateButton("解锁", 304, 88, 57, 25)
GUICtrlSetState(-1,128)
$Label3 = GUICtrlCreateLabel("密码重置", 32, 136, 68, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Input2 = GUICtrlCreateInput("", 152, 136, 113, 24)
$Button3 = GUICtrlCreateButton("重置", 304, 136, 57, 25);11
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $account = GUICtrlRead($Input1)
        $mima = GUICtrlRead($Input2)
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case -3
                        Exit
                Case $Button1
                        If _AD_IsObjectLocked($account) Then
                                GUICtrlSetState($Checkbox1,65)
                                GUICtrlSetState($Button2,64)
                        Else
                                GUICtrlSetState($Checkbox1,128)
                                GUICtrlSetState($Button2,128)
                        EndIf
                Case $Button2
                        $iValue = _AD_UnlockObject($account)
                        If $iValue = 1  And  GUICtrlGetState($Checkbox1) = 80 Then
                                GUICtrlSetState($Checkbox1,128)
                                GUICtrlSetState($Button2,128)                
                        EndIf
                Case $Button3
                        If $account <> "" Then
                                If _AD_SetPassword($account,$mima,1) Then
                                        MsgBox(4096,"成功","重置成功!")
                                EndIf
                    Else
                            MsgBox(4096,"注意","请输入要重置的账号!")
                        EndIf
        EndSwitch
WEnd
AD UDF的地址 http://www.autoitx.com/forum.php ... 17&highlight=AD

评分

参与人数 1威望 +3 金钱 +20 贡献 +3 收起 理由
pusofalse + 3 + 20 + 3

查看全部评分

发表于 2011-5-16 23:31:27 | 显示全部楼层
Case 5、Case 8、GUICtrlRead(3)、GUICtrlSetState(7),这样写楼主能看得懂吗?$Input1、$Button2,且不说这些变量的名称如何,定义这些变量有何用途。等哪天需要改写代码时,还要用窗口信息工具挨个检查控件ID吗?~
 楼主| 发表于 2011-5-16 23:54:09 | 显示全部楼层
本帖最后由 502762378 于 2011-5-16 23:55 编辑

回复 2# pusofalse

P版您说的是,也是这个工具控件少,心血来潮这样搞的,呵呵
想想确实不太好,马上改正
发表于 2011-5-17 00:50:50 | 显示全部楼层
呵呵,支持一下!
发表于 2012-6-4 11:53:52 | 显示全部楼层
支持下子,,呵呵,
发表于 2012-6-9 11:06:51 | 显示全部楼层
谢谢分享。。我试试
发表于 2012-8-2 15:49:10 | 显示全部楼层
真心强大~顶~
发表于 2012-8-2 15:49:16 | 显示全部楼层
真心强大~顶~
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-10 15:54 , Processed in 0.079391 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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