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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User Name and Domain Name

Status
Not open for further replies.

abdullauthan

Programmer
Apr 20, 2000
64
SA
Is there any way to get the User Name and NT Domain name using API? [sig][/sig]
 
I am not sure how to get the domain name, but you can get the user with this.

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

Dim lpBuff As String * 25
Dim ret As Long, sUserName As String

ret = GetUserName(lpBuff, 25)
sUserName = Left(lpBuff, InStr(lpBuff, Chr(0)) - 1)
sUserName = UCase(sUserName)


[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top