Solved

get user login by vb6

Posted on 2012-04-10
5
447 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 47

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB.Net Data Class 1 48
How to set focus on a dynamic control 18 52
Modify Text File with Excel Macro 13 49
Datagridview column resizing 8 27
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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
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…

734 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