Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Current login username
Message
 
À
08/02/2006 15:11:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01094665
Message ID:
01094777
Vues:
12
Don't work. Both return "Steve"


>What does this return?
>
>CLEAR all
>clear
>#DEFINE NO_ERROR 0
>
>DECLARE INTEGER WNetGetUser IN mpr;
>   INTEGER lpName, STRING @lpUserName, INTEGER @lpnLength
>
>LOCAL lcUser, lnBufsize
>lnBufsize = 250
>lcUser = Repli(Chr(0), lnBufsize)
>
>IF WNetGetUser(0, @lcUser, @lnBufsize) = NO_ERROR
>   ? "Default user name:", SUBSTR(lcUser, 1, AT(Chr(0),lcUser)-1)
>ENDIF
>RELEASE DLL "WNetGetUser"
>
>*OR
>
>
>DECLARE INTEGER WNetGetUser ;
>IN Win32API ;
>AS GetLoginName ;
>   STRING, STRING @, INTEGER @
>LOCAL lcUserName, lnNameLength, lnResult
>lnNameLength = 256
>lcUserName   = SPACE( m.lnNameLength )
>lnResult     = GetLoginName( 0, @lcUsername, @lnNameLength )
>lcUserName   = LEFT( m.lcUserName, AT( chr(0), m.lcUserName)-1 )
>
>? lcUserName
>RELEASE DLL "WNetGetUser"
>
>
>>>Check the system username variable.
>>>
>>>? GETENV('USERNAME')
>>>
>>
>>Does not work(tried that). It return "Steve" not "Steve1"
>>
>>They must be something for that simple request but did find it in UT.
>>
>>Any other ideals?
Lead programmer of the free MIS Info Video(Frontend/player), Info 2 MIS or visit me at Steve's Tech Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform