Finding what User is logged into the computer or domain

Hunter666

Registered User.
Local time
Today, 14:01
Joined
Mar 28, 2002
Messages
20
I need to be albe to read the registry or something to that effect, to be able to tell what User is currently logged into the computer or domain. Can anyone help??
 
Are you wanting to know the name of the user who is logged on to a computer to use it in a database? or do you want to know how many and which users are actually logged into a database

Col
 
I need to find what user is logged into the computer. Can you help?
 
I use a function someone gave me to determine the Network username from the Windows Registry. This works on Win98 and Win2k.
Go to the Modules tab, click on New. Paste this in exactly as written:

code:
--------------------------------------------------------------------------------

Option Compare Database
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As StringstrUserName = String$(254, 0)lngLen = 255lngX = apiGetUserName(strUserName, lngLen)
If lngX <> 0 Then
fOSUserName = Left$(strUserName, lngLen - 1)Else
fOSUserName = ""
End If
End Function

--------------------------------------------------------------------------------

Now you can use fOSUserName() (or as a control source, for example, =fOSUserName() )to stand for your user's login name to the computer.

It doesn't matter what you name the module when you save it. Only the function name matters.

Col
ps - thanks to David R for this




[This message has been edited by ColinEssex (edited 05-14-2002).]
 
Yes - well I think not really !

As I said in my post - thanks to David R for that, glad it worked ok though

Col
 

Users who are viewing this thread

Back
Top Bottom