• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 455
  • Last Modified:

get user login by vb6

I'm using VB6 so I want to know how I can get the username who logged to the windows to use it as syslog on my application for whom login to my system from his machine and do some activities.

Thanks
Mostafa
0
Mostafa_ElSadek
Asked:
Mostafa_ElSadek
1 Solution
 
AnuroopsunddCommented:
Sub Get_User_Name()

     ' Dimension variables
     Dim lpBuff As String * 25
     Dim ret As Long, UserName As String

     ' Get the user name minus any trailing spaces found in the name.
     ret = GetUserName(lpBuff, 25)
     UserName = Left(lpBuff, InStr(lpBuff, Chr(0)) - 1)

     ' Display the User Name
     MsgBox UserName
     End Sub
            
http://support.microsoft.com/kb/152970
0
 
Neil RussellTechnical Development LeadCommented:
See http://www.go4expert.com/forums/showthread.php?t=208

This explains how to read the environment variables like %USERNAME% etc that are available in a command prompt.
0
 
vbighamCommented:
(Environ$("Username"))
0
 
Martin LissOlder than dirtCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now