Link to home
Start Free TrialLog in
Avatar of sgrobins
sgrobins

asked on

Getting username on WinNT / Win95

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
Avatar of Answers2000
Answers2000

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 ?
There is an SDK Function GetUserName(LPCTSTR StringPointer, DWORD* LengthofAllocatedString) which will return user name in StringPointer.
ASKER CERTIFIED SOLUTION
Avatar of Answers2000
Answers2000

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sgrobins

ASKER

GetUserName worked perfectly.  Not sure how I overlooked that one, but Thanks.