Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Finding out who the user is...
Message
 
À
21/01/1999 16:54:27
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00178748
Message ID:
00178914
Vues:
26
Hi Eric,

Try this.

*==============================================================================
* Method: GetDefaultUserName
* Purpose: Gets the name of the user logged onto the machine at the * operating system level.
* Author: F1 Technologies
* Parameters:
* Returns:
*==============================================================================
LOCAL ;
lcNull, ;
lcUserId, ;
lnLen

lcNull=""
lcUserId=SPACE(255)
lnLen=255

* Use the WNetGetUser function in the Win32API to get the user id
DECLARE INTEGER WNetGetUser IN WIN32API String @, String @, Integer @
IF WNetGetUser(@lcNull,@lcUserId,@lnLen)=0
lcUserId=UPPER(LEFT(lcUserId,AT(CHR(0),lcUserId)-1))
ELSE
lcUserId = ""
ENDIF

RETURN ALLTRIM(lcUserId)
Mike Feltman

F1 Technologies
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform