Results 1 to 5 of 5

Thread: NetUserChangePassword

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2001
    Location
    Thailand
    Posts
    221

    Question NetUserChangePassword

    How can I use this function?

    Public Declare Function NetUserChangePassword Lib "Netapi32.dll" (Domain As Any, User As Any, OldPass As Byte, NewPass As Byte) As Long

    I have no isea for it because I don't know why the data type of OldPass and NewPass is Byte.
    Teeravee Sirinapasawasdee
    Gestalt IT Consulting Group
    Growth Your Business With e-Process

  2. #2
    YosiHarari
    Guest
    Hey,
    Why Don't U Use ADSI ?
    There is function of the User object - "SetPassword".
    Much Easier and the differences in the speed are minors.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2001
    Location
    Thailand
    Posts
    221

    How?

    How can I use ADSI and what is it?
    Teeravee Sirinapasawasdee
    Gestalt IT Consulting Group
    Growth Your Business With e-Process

  4. #4
    YosiHarari
    Guest
    Hey,
    ADSI is Actice Directory Service Interface.
    It's few dll's that make the access to the network, the domain, computers, services and users real easy.
    U can manage all your network with ADSI.
    U Add a reference to "Active DS Type Library".
    U define var as IadsUser, and when U'll right "MyVar." , U'll see it's properties.

  5. #5
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    Whoever wrote the api declaration did a poor job. BTW, there are some mistakes in the API viewer, but mostly they are correct.

    Here is an example of using the NetUserChangePassword api.

    Code:
    Private Declare Function NetUserChangePassword Lib "netapi32.dll" (ByVal Domain As String, ByVal User As String, ByVal OldPass As String, ByVal NewPass As String) As Long
    
    Private Sub Command1_Click()
    Dim retVal As Long
    Dim sDomain As String
    Dim sUser As String
    Dim sOldPass As String
    Dim sNewPass As String
        sDomain = vbNullString ' use the logon domain
        sUser = StrConv("test123", vbUnicode) ' use vbNullString to change the currently logged on user's password
        sOldPass = StrConv("test123", vbUnicode)
        sNewPass = StrConv("123test", vbUnicode)
        retVal = NetUserChangePassword(sDomain, sUser, sOldPass, sNewPass)
    End Sub
    PS if you want you can change the declaration to Public if you use a bas module for it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width