Solved

Getting username on WinNT / Win95

Posted on 1998-09-01
4
219 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
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…
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…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

689 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