Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Finding out who the user is...
Message
De
27/01/1999 09:45:17
 
 
À
27/01/1999 08:01:21
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00178748
Message ID:
00180735
Vues:
25
Ed,

Here is the function as I've tried to use it. Calling it with
GetUser("C:")
GetUser("V:") (mapped drive)
GetUser("æøå") (garbage)
all returns my username...


* FUNCTION GetUser
LPARAMETERS ltcResource
LOCAL lcResource, lcUserId, lnLen

IF TYPE("ltcResource") = "C"
	lcResource = ltcResource
ELSE
	lcResource = ""
ENDIF
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(lcResource + CHR(0), @lcUserId, @lnLen) = 0
 lcUserId = UPPER(LEFT(lcUserId, AT(CHR(0), lcUserId) - 1))
ELSE
 lcUserId = ""
ENDIF

RETURN ALLTRIM(lcUserId)
Arne
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform