Solved

Login Information

Posted on 1999-01-07
3
127 Views
Last Modified: 2010-05-03
How can I get the username for the person logged into the server (winnt/win95/win98) from VB? I need to validate the user to allow different levels to access different parts of the program without having them re-login or keeping a password list.
0
Comment
Question by:dtyson010799
3 Comments
 
LVL 3

Accepted Solution

by:
myqlG earned 50 total points
ID: 1454659
Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

and where ever you want to check it (ill use a command button)
Private Sub Command1_Click()
Dim x As String, y As Long
x = Space$(255)
 y = 255
 GetUserName x, y
x = Left$(x, y)
MsgBox x
End Sub

0
 

Author Comment

by:dtyson010799
ID: 1454660
Thanks
That was exactly what I was looking for.
0
 

Expert Comment

by:soyapi
ID: 3360450
Yes! How to validate user so no access deny.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

770 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