Solved

Login Information

Posted on 1999-01-07
3
125 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

708 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

20 Experts available now in Live!

Get 1:1 Help Now