Member Login

Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Using Username and Password from Windows

Using Username and Password from Windows


When a user must login into my programm I woul'd like to use the Windows username an password of the currently logged in user. I know that the username can be found by using the GetUserName function but I don't have a clue how to check the password. I understand that the password on itself is not retrievable but there must be a way to do this. This because I've seen it work with an application.

Can anyone help me with this?

Thanks, Peter.

RE: Using Username and Password from Windows

In your dreams, pal.  Can you see the spyware comming out sending userID and password back to the authors?  Passwords are evaluated with a one-way algorithm:  if X is the password then f(X) is calculated and compared to an f(X) stored in the SAM file.  Knowing f(X) does not allow you to recalculate X.  Why would you need the password anyway?

RE: Using Username and Password from Windows

I'm not interested in the password but want to check of a given password equals the windows logon password. The UserID I can get (in normal format) with the GetUserName function in the windows API.

RE: Using Username and Password from Windows

forgot where I got this but it worked on my Win98 box.
does not work on my WinXP box though.

Private Declare Function WNetVerifyPassword Lib "mpr.dll" Alias _
    "WNetVerifyPasswordA" (ByVal lpszPassword As String, _
    ByRef pfMatch As Long) As Long

Private Function VerifyWindowsLoginUserPassword _
        (ByVal Password As String) As Boolean
    Dim rtn As Long, Match As Long
    rtn = WNetVerifyPassword(Password, Match)
    If rtn Then
        VerifyWindowsLoginUserPassword = False
        VerifyWindowsLoginUserPassword = (Match <> 0)
    End If
    Debug.Print rtn, Match
End Function

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close