Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

windows username and password

Status
Not open for further replies.

FALCONSEYE

Programmer
Jul 30, 2004
1,158
US
hi,

i am using cold fusion and working on an application where i need to develop an interface to get the user's windows OS username and password. i heard this could be done by VBScript. can anyone come across a similar issue? if so, could you please give me some advice?
thanks for the help in advance
 
This gets the user login name. If you could discover the password it would rather defeat the object, wouldn'tit ??
Code:
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
    "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long


Sub test()
    X = fOSUserName
    MsgBox (X)
End Sub


Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
    strUserName = String$(254, 0)
    lngLen = 255
    lngX = apiGetUserName(strUserName, lngLen)
    If (lngX > 0) Then
        fOSUserName = Left$(strUserName, lngLen - 1)
    Else
        fOSUserName = vbNullString
    End If
End Function

Regards
BrianB
Use CupOfCoffee to speed up all windows applications.
It is easy until you know how.
================================
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top