User Name from START menu? (not System.Environment.UserName)
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: User Name from START menu? (not System.Environment.UserName)

  1. #1
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    210

    User Name from START menu? (not System.Environment.UserName)

    Hi,

    how can I obtain the name which is displayed on top of the Windows START menu?

    Mike

  2. #2
    Join Date
    Sep 2008
    Location
    Netherlands
    Posts
    865

    Re: User Name from START menu? (not System.Environment.UserName)

    First add System.DirectoryServices as reference to your project, next use the next code
    Code:
             string servername = Environment.UserDomainName;
             string username = Environment.UserName;
    
             using (System.DirectoryServices.DirectoryEntry domain = new
             System.DirectoryServices.DirectoryEntry(string.Format("WinNT://{0}/{1}", servername, username))) {
                string fullName = domain.Properties["FullName"].Value.ToString() ;            
             }

  3. #3
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    210

    Re: User Name from START menu? (not System.Environment.UserName)

    Thx!
    Last edited by MNovy; January 13th, 2009 at 06:40 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center