Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This function retrieves the name of the user or other security principal associated with the calling thread. You can specify the format of the returned name.
BOOLEAN GetUserNameEx(
EXTENDED_NAME_FORMAT NameFormat,
LPTSTR lpNameBuffer,
PULONG nSize
);
If the function succeeds, the return value is a nonzero value.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
If the lpNameBuffer buffer is too small to hold the name, the function fails and nSize receives the required buffer size.
OS Versions: Windows CE .NET 4.0 and later.
Header: Winbase.h.
Link Library: Coredll.lib.
SetUserData | SetCurrentUser | EXTENDED_NAME_FORMAT
Last updated on Wednesday, April 13, 2005
© 2005 Microsoft Corporation. All rights reserved.
Please sign in to use this experience.
Sign in