Solved

Getting username on WinNT / Win95

Posted on 1998-09-01
4
214 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
0
Comment
Question by:sgrobins
  • 2
4 Comments
 
LVL 8

Expert Comment

by:Answers2000
ID: 1414114
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 ?
0
 

Expert Comment

by:ratheesh
ID: 1414115
There is an SDK Function GetUserName(LPCTSTR StringPointer, DWORD* LengthofAllocatedString) which will return user name in StringPointer.
0
 
LVL 8

Accepted Solution

by:
Answers2000 earned 50 total points
ID: 1414116
ratheesh -
I thought I said that yesterday <g>, maybe there's an echo in here.

sgrobins -
GetUserName will give you the account name of the current user.  Use LookupAccountName to find further information on that user.  
I think this is enough for you ?  If it's not enough post further comments telling us what else you need.

BTW NetUserEnum gives you Unicode strings back.  So if you stick to this funciton, you either need to compile you app as Unicode OR to convert the returned strings into 8 bit character set
0
 

Author Comment

by:sgrobins
ID: 1414117
GetUserName worked perfectly.  Not sure how I overlooked that one, but Thanks.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

910 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

22 Experts available now in Live!

Get 1:1 Help Now