473,386 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Windows Login Name

Hi

How can I get the currently logged in username from windows 2000/xp?

Thanks

Regards


Nov 12 '05 #1
2 4244
"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:40*********************@news.dial.pipex.com.. .
How can I get the currently logged in username from windows 2000/xp?


It is an API call. See:
http://www.mvps.org/access/api/api0008.htm

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
Nov 12 '05 #2
RE/
How can I get the currently logged in username from windows 2000/xp?


-------------------------------------
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA"
(ByVal lpBuffer As String, nSize As Long) As Long
Public Function userIdWindowsGet() As String
debugStackPush mModuleName & ": userIdWindowsGet"
On Error GoTo userIdWindowsGet_err

' PURPOSE: To retrieve the Windows UserID of the person currently logged on to
this PC
' RETURNS: UseID or empty string

Dim myBuffer As String * 255
Dim myUserName As String

GetUserName myBuffer, Len(myBuffer) 'Get the
user name
myUserName = Left(Trim(myBuffer), InStr(myBuffer, Chr(0)) - 1) 'Trim excess
characters

If Len(myUserName) > 0 Then
userIdWindowsGet = myUserName
Else
bugAlert True, "Unable to get Windows UserID"
End If

userIdWindowsGet_xit:
debugStackPop
On Error Resume Next
Exit Function

userIdWindowsGet_err:
bugAlert True, ""
Resume userIdWindowsGet_xit
End Function
-------------------------------------
--
PeteCresswell
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: sherkozmo | last post by:
I have my SQL 7.0 server set for Mixed security. I see now (finally) the advantages of having windows authentication security for windows groups. I do most of my developing in Access Projects...
3
by: tbone | last post by:
We were using sql authentication on our sql server 2000 servers, But need to use windows authentication. I have an sql user jdoe that owns many different objects in multiple databases. I have...
3
by: Neil Ginsberg | last post by:
Is it possible to use a Windows 2000 log-in as the log-in for Access user-level security, thus circumventing the Access prompt? Neil
8
by: Nils Magnus Englund | last post by:
Hello, I am having trouble using Integrated Windows Authentication between our intranet server and our database server, both of which are on our local domain. Windows authentication works for...
11
by: Eric | last post by:
Hello, I have a web app that uploads files to a file server (different box than the web server). The application uses NT integrated authentication, but no users should have permissions to the...
3
by: serge calderara | last post by:
Dear all, I clearly underdand the advantage of both type of authentification but is it allowed or possible to set the Authentication mode to Windows and then handle a login form for defined...
6
by: =?Utf-8?B?UGFyYWcgR2Fpa3dhZA==?= | last post by:
Hi All, We have a requirement where we have to develop a custom Login Page which will accept user's NT credentials ( Username , password, domain name). This then needs to be passed to a website...
1
by: roshina | last post by:
Hi Iam facing a problem in my project, developing a web site for online shopping in ASP on windows XP using IIS server. All the validations are ok but the new password is not upadated in the data...
1
by: thaixyz | last post by:
Hi, I am migrating SQL 2000 database from one machine to another using the detach/attach method. I used the TSQL script sp_help_revlogin procedure provided by microsoft to copy the logins, this...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.