Skip to content

Latest commit

 

History

History
56 lines (38 loc) · 1.55 KB

File metadata and controls

56 lines (38 loc) · 1.55 KB

Home

Function name : GetUserName

Group: System Information - Library: advapi32


Retrieves the user name of the current thread. This is the name of the user currently logged onto the system.


Code examples:

Retrieving local computer and user names
Obtaining names of local and global groups for current user (WinNT/XP/2K)
Finding out if the current user is the Guest account

Declaration:

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

FoxPro declaration:

DECLARE INTEGER GetUserName IN advapi32;
	STRING @lpBuffer,;
	INTEGER @nSize  

Parameters:

lpBuffer Points to the buffer to receive the null-terminated string containing the user"s logon name.

nSize Pointer to a DWORD that, on input, specifies the maximum size, in characters, of the buffer specified by the lpBuffer parameter.


Return value:

If the function succeeds, the return value is a nonzero value.


Comments:

SYS(0) -- the network machine information -- returns computer name and user name in one string.

See also: GetUserNameEx, GetComputerName, GetComputerNameEx.