Solved

How to get the user/password of client machine ?

Posted on 2002-05-30
5
147 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Access 2016 VB code 9 115
Cannot enter table caption text in Word protected document 6 123
MS Access Search and Replace Using VBA 6 69
TT Auto Dashboard 13 91
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

805 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