We help IT Professionals succeed at work.

Getting username on WinNT / Win95

sgrobins
sgrobins asked
on
Medium Priority
250 Views
Last Modified: 2013-12-03
I have a program and need to get the current user that is logged in on the WinNT or Win95 machine.  I am using ILOG as the API.  Is there an easy way to get the user information.  I tried using the USER_INFO_10 struct, but was unsuccessful. If this is the method of choice, can someone give a quick example on how to use the struct properly.

Thanks,
Shawn
Comment
Watch Question

Can't you use GetUserName

USER_INFO_10 structure is typically used with NetUserEnum API which enumerates all user accounts on a server.

Exactly what information do you need about the current user ?

Commented:
There is an SDK Function GetUserName(LPCTSTR StringPointer, DWORD* LengthofAllocatedString) which will return user name in StringPointer.
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
GetUserName worked perfectly.  Not sure how I overlooked that one, but Thanks.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.