Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get User Name from the OS
Message
From
18/10/1998 18:43:30
Cheryl Qualset
Qualset Computer Consulting
Davis, California, United States
 
General information
Forum:
Visual FoxPro
Category:
FoxPro 2.x
Miscellaneous
Thread ID:
00147628
Message ID:
00147971
Views:
36
>>Thanks for the suggestion Ken. Unfortunately, when run in FoxPro 2.6, both the ID() and sys(0) functions return the machine name in the following form: "9JHP4 # 255". In VFP, both of the functions return the name in this form: "9JHP4 #VALIDNAME". It seems the 16 bit version returns only the machine number.
>
>For NT Workstation Try:
>set default to c:\winnt\system (or wherever your windows system folder is located)
>
>! net config workstation >c:\netuser.txt then parse the file low level. I believe the user will be the second line in the output file.
>
>For Windows 95/98 I'm not sure look at the net command switches by opening a dos session and typing net /? in the windows subdirectory.

NT has a default environment variable called username.
I use GETENV('username')
Also, our Netware login script creates a similar environment variable for DOS/Win/95 users.

This has some security issues. But in 95, the user has to run the app from a batch file that changes the environment variable and then runs the app because just changing an envar in a DOS window doesn't affect anything but that DOS session.

Cheryl Qualset
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform