Solved

get user login by vb6

Posted on 2012-04-10
5
439 Views
Last Modified: 2012-05-10
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
Comment
Question by:Mostafa_ElSadek
5 Comments
 
LVL 17

Accepted Solution

by:
Anuroopsundd earned 500 total points
ID: 37831247
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
 
LVL 37

Expert Comment

by:Neil Russell
ID: 37831251
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
 
LVL 7

Expert Comment

by:vbigham
ID: 37834317
(Environ$("Username"))
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 37951045
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

706 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

18 Experts available now in Live!

Get 1:1 Help Now