 |
GetUserName Add comment W32 Constants Translate this page |
 |
 |
|
Retrieves the user name of the current thread. This is the name of the user currently logged onto the system. |
 |
 |
| Code examples: |
 |
|
|
 |
 |
| 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. |
 |
 |
| Usage: |
 |
nSize = 250
cBuffer = REPLICATE(Chr(0), nSize)
= GetUserName(@cBuffer, @nSize)
cBuffer = STRTRAN(cBuffer, CHR(0), "")
? cBuffer
? GETENV("USERNAME")
|
 |
 |
| My comment: |
 |
SYS(0) -- the network machine information -- returns computer name and user name in one string.
See also: GetUserNameEx, GetComputerName, GetComputerNameEx |
 |
 |
| Word Index links for the GetUserName : |
 |
|
|
 |
 |
| Translate this page: |
 |
|
 |
 |
| • |
 |
| Created: | 2001-07-14 12:00:00 | | Modified: | 2009-01-07 12:46:57 | Visited in last 7 days: 65 |