AD管理之账号解锁重置
本帖最后由 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 = 1AndGUICtrlGetState($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
WEndAD UDF的地址 http://www.autoitx.com/forum.php?mod=viewthread&tid=22817&highlight=AD Case 5、Case 8、GUICtrlRead(3)、GUICtrlSetState(7),这样写楼主能看得懂吗?$Input1、$Button2,且不说这些变量的名称如何,定义这些变量有何用途。等哪天需要改写代码时,还要用窗口信息工具挨个检查控件ID吗?~ 本帖最后由 502762378 于 2011-5-16 23:55 编辑
回复 2# pusofalse
P版您说的是,也是这个工具控件少,心血来潮这样搞的,呵呵
想想确实不太好,马上改正 呵呵,支持一下! 支持下子,,呵呵, 谢谢分享。。我试试 真心强大~顶~ 真心强大~顶~
页:
[1]