by Jacob Steenhagen (3 Submissions)
Category: Windows API Call/Explanation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 24th July 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Change your Novell Password
API Declarations
Declare Function NWDSChangeObjectPassword Lib "netwin32" (ByVal context As Long, ByVal optionsFlag As Long, ByVal objectName As String, ByVal oldPassword As String, ByVal newPassword As String) As Long
Declare Function NWDSFreeContext Lib "netwin32" (ByVal context As Long) As Long
Dim Change As Integer
Dim cx As Variant ' I'm not sure what type of variable cx needs to be, but it works as a variant
cx = NWDSCreateContext
Change = NWDSChangeObjectPassword(cx, 1, txtUser.Text, txtOldPass.Text, txtNewPass.Text)
NWDSFreeContext (cx)
' Handle Errors
Select Case Change
Case 0 ' Password Changed
MsgBox "Your password is now Changed", , "Done"
Case -215 ' Password not Unique
MsgBox "You've used that Password before, Please try again", , "Error -215"
Exit Sub
Case -216 ' Password too Short
MsgBox "Your new password need to be longer, Please try again", , "Error -216"
Exit Sub
Case -669 ' Bad Incoming Password
MsgBox "You typed your old password incorrectly, Please try again", , "Error -669"
Exit Sub
Case Else
' There may be other errors I haven't accounted for... so as always, test it... :O)
MsgBox Change
End Select
End Sub