Using Win32 functions in Visual FoxPro Image Gallery
System Information
..msdn
ExpandEnvironmentStrings
GetComputerName
GetComputerNameEx
GetComputerObjectName
GetCurrentHwProfile
GetKeyboardType
GetNativeSystemInfo
GetProductInfo
GetSysColor
GetSystemDirectory
GetSystemInfo
GetSystemMetrics
GetSystemRegistryQuota
GetSystemWow64Directory
GetUserName
GetUserNameEx
GetVersion
GetVersionEx
GetWindowsDirectory
IsNetworkAlive
SetComputerName
SetSysColors
SystemParametersInfo
Code examples:
Finding out if the current user is the Guest account
Obtaining names of local and global groups for current user (WinNT/XP/2K)
Retrieving local computer and user names
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:
Finding out if the current user is the Guest account
Retrieving local computer and user names
Obtaining names of local and global groups for current user (WinNT/XP/2K)
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:
  Spanish    Portuguese    German    French    Italian  
FreeTranslation.com offers instant, free translations of text or web pages.
Created: 2001-07-14 12:00:00
Modified: 2009-01-07 12:46:57
Visited in last 7 days: 20
User Contributed Notes:
There are no notes on this subject.


Copyright 2001-2017 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

Privacy policy
Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.6.38), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (54.81.178.153)
19 sec.Function: 'GetBinaryType'
38 sec.Function: 'PathGetDriveNumber'
57 sec.Function: 'UuidToString'
1.27 min.Function: 'UrlGetPart'
1.6 min.
Function group: 'DNS Functions'
1.97 min.Function: 'WTSEnumerateProcesses'
2.33 min.Function: 'SQLFetch'
2.78 min.Function: 'InternetSetFilePointer'
4.05 min.Function: 'GetClipboardSequenceNumber'
14.27 hrs.Function: 'SearchPath'
Google
Advertise here!