Sign in to follow this  
Boltimus

Getting a list of user names in win32

Recommended Posts

Boltimus    100
I am trying to get a list of the names of users that have accounts on the computer. At first I was simply going to let the user enter that information in, however I'm concerned that they may mispell somthing, etc So instead I would rather get the list of the names and let the user select which account he is referencing on the computer. The thing is, I know in windows you get their from control panel -> User Accounts and it lists the names of the accounts. How do I get this inside of an application? Is there some API call I can make? I know about the GetUserName call, but that is only good for the ucrrent user. Is there a registry setting that I can read? Thx!!

Share this post


Link to post
Share on other sites
Boltimus    100
I thought of a crude way of doing this unless someone can think of something better.... basically I could get the path for all the user's profiles and then look at the folder names... a bit crude but my only option right now unless i can get a registry entry....

Share this post


Link to post
Share on other sites
Anon Mike    1098
Why exactly do you want to do this?

You can probably use a combination of NetLocalGroupEnum to get all the groups on the machine and NetLocalGroupGetMembers to get the members. That should get you most of the way there. You may need to have certain permissions for it to work though.

Share this post


Link to post
Share on other sites
aaron_ds    486
GetProfilesDirectory sounds like the easiest way.

I'm assuming you've looked through the MSDN reference.

If you havn't try looking up "Win32_Account", "WMU C++ Application Examples"

Unfortunatly there is a lot of information on creating and deleting user accounts, but nothing specific to enumerating them.

Good luck.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this