Solved

How to get the user/password of client machine ?

Posted on 2002-05-30
5
146 Views
Last Modified: 2010-05-02
How can I get the User name/password of the local machine used to log on BY THE LOCAL user.

0
Comment
Question by:chirawa
5 Comments
 
LVL 6

Accepted Solution

by:
xSinbad earned 50 total points
ID: 7046257
I dont know about getting the password but have a look at these two examples

Username in NT msgbox environ("UserName")

or

API

Declare Function GetUserName Lib "advapi32" Alias "GetUserNameA" (ByVal strName As String, ByRef dwLength As Long) As Long

intLen = 50
strUserID = Space(intLen + 1)
GetUserName strUserID, intLen
strUserID = Left(strUserID, intLen - 1)
msgbox strUserID

(TimCottee  - Q_20219899)

http://www.vbcode.com/asp/showsn.asp?theID=1075 
http://www.vbcode.com/asp/showsn.asp?theID=3795
0
 
LVL 33

Expert Comment

by:hongjun
ID: 7046269
Retrieve user name

Option Explicit

Private Const UNKNOWN = _
"(Value Unknown Because System Call Failed)"

Private Declare Function GetUserName Lib "advapi32.dll" _
Alias "GetUserNameA" (ByVal lpBuffer As String, nSize _
As Long) As Long

Public Function GetCurrentUserName() As String

Dim l As Long
Dim sUser As String

sUser = Space$(255)
l = GetUserName(sUser, 255)

'strip null terminator

If l <> 0 Then
   GetCurrentUserName = Left(sUser, InStr(sUser, Chr(0)) - 1)
Else
   Err.Raise Err.LastDllError, , _
     "A system call returned an error code of " _
      & Err.LastDllError
End If

End Function


Private Sub Form_Load()
    MsgBox GetCurrentUserName()
End Sub



Retrieve Password? Researching.

hongjun
0
 
LVL 2

Expert Comment

by:ventond
ID: 7048022
Hopefully the password is not stored, therefore unreturnable.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7851310
Hi chirawa,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept xSinbad's comment(s) as an answer.

chirawa, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 

Expert Comment

by:SpideyMod
ID: 7912899
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now