Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do get a user login name from Windows
Message
De
30/04/2001 17:55:38
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00501724
Message ID:
00501814
Vues:
30
Hi Stuart.

>I need to be able to find the user name a person has used to login onto Windows 2000 Server from within a FoxPro application.

Here's what I use:
local lcName, ;
    lnSize, ;
    lcUser, ;
    lnStatus

* Initialize the variables we need and declare the Windows function.

lcName = chr(0)
lnSize = 64
lcUser = replicate(lcName, lnSize)
declare integer WNetGetUser in Win32API ;
    string @cName, string @cUser, integer @nBufferSize

* Call the function and return the result.

lnStatus = WNetGetUser(@lcName, @lcUser, @lnSize)
lcUser   = iif(lnStatus = 0, upper(left(lcUser, at(chr(0), lcUser) - 1)), '')
return lcUser
Doug
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform