nbsp; Call CreateAlertMarkup(strDialogText)
End If
Else
'' generate the alert dialog HTML
strDialogText = """口令不能为空。"""
Call CreateAlertMarkup(strDialogText)
End If
End If
Set adsUser = Nothing
'' 提交事务
objCtx.SetComplete
'' 释放事务对象
Call ReleaseObjectReferences
Exit Sub
''**********
ChangePasswordErrorHandler:
'' log the failed attempt
Call LogNTEvent("企图修改用户 " & pstrUser & _
" 的口令失败!", EVENTLOG_ERROR_TYPE, 1003)
'' generate the alert dialog HTML with PASSFILT.DLL simulated error message
strDialogText = """用户 " & pstrUser & "的口令不能被修改,原因如下:\n\n"
strDialogText = strDialogText & "1. 你原有的口令" & "输入不对。\n"
strDialogText = strDialogText & "2. 口令必须为6个以上的" & "字符长度。\n"
strDialogText = strDialogText & "3.口令只能包含" & "一下特殊字符:\n"
strDialogText = strDialogText & " - 英文大写字母 (A-Z)\n"
strDialogText = strDialogText & " - 英文小写字母 (a-z)\n"
strDialogText = strDialogText & " - 阿拉伯数字 (0-9)\n"
strDialogText = strDialogText & " - 特殊字符" & "比如标点符号\n"""
Call CreateAlertMarkup(strDialogText)
‘ 终止事务
objCtx.SetAbort
'' 释放事务
Call ReleaseObjectReferences
End Sub
(10)添加一个函数取得系统的真实域控制器名:
'' returns the PDC machine name
Private Function GetPrimaryDCName(pstrMachineName As String) As String
Dim DCName As String
Dim DCNPtr As Long
Dim DNArray() As Byte
Dim DCNArray(100) As Byte
Dim result As Long
Dim strDialogText As String
'' find the PDC
DNArray = pstrMachineName & vbNullChar
result = NetGetDCName(0&, DNArray(0), DCNPtr)
If result <> 0 Then
'' generate the alert dialog HTML
strDialogText = """域 " & pstrMachineName & " 的控制器没有找到。"""
Call CreateAlertMarkup(strDialogText)
Exit Function
End If
lstrcpyW DCNArray(0), DCNPtr
result = NetApiBufferFree(DCNPtr)
DCName = DCNArray()
GetPrimaryDCName = Left(DCNam