Get full name of user

  • Thread starter Thread starter Chris Clement
  • Start date Start date
C

Chris Clement

I am trying to get the full name of a user not logged into a network on
Windows 2000/XP. I know how to get the user name (cclement), but how do I
get the full display name (Chris Clement) as it is displayed in the start
menu in Windows XP?

Any help is appreciated.

Chris
 
Chris,

You can call the GetUserNameEx API function through the P/Invoke layer
to get the display name. For the NameFormat parameter, you can pass the
value of NameDisplay from the EXTENDED_NAME_FORMAT enumeration (it has a
value of 3).

Hope this helps.
 
Thanks for the reply, Nicholas. Do you know of any resource that can show
me how to use APIs like this in a c# program. Or could you give me an
example of its usage. thanks again.

Chris



Nicholas Paldino said:
Chris,

You can call the GetUserNameEx API function through the P/Invoke layer
to get the display name. For the NameFormat parameter, you can pass the
value of NameDisplay from the EXTENDED_NAME_FORMAT enumeration (it has a
value of 3).

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Chris Clement said:
I am trying to get the full name of a user not logged into a network on
Windows 2000/XP. I know how to get the user name (cclement), but how do I
get the full display name (Chris Clement) as it is displayed in the start
menu in Windows XP?

Any help is appreciated.

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top