CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: NT/XP username

  1. #1
    Join Date
    Jun 2001
    Location
    Michigan
    Posts
    2,222

    NT/XP username

    All I want to do is extract a NT username from the registry or a system variable or wherever, how can I do this? How do I properly use GetEnvironmentVariable() properly?

  2. #2
    igbrus is offline Elite Member Power Poster
    Join Date
    Aug 2000
    Location
    Los Angeles
    Posts
    4,658
    What about GetUserName

  3. #3
    Join Date
    Mar 2002
    Posts
    350
    You can use

    BOOL GetUserName(
    LPTSTR lpBuffer, // name buffer
    LPDWORD nSize // size of name buffer
    );

    If the buffer is too small, the function fails GetLastError returns ERROR_MORE_DATA. The nSize parameter receives the required buffer size.

  4. #4
    Join Date
    Jun 2001
    Location
    Michigan
    Posts
    2,222
    Thanks it works!

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured