Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Where does SYS(0) get its information
Message
 
To
20/07/2001 04:51:11
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00533019
Message ID:
00533024
Views:
10
You can use the API functions GetComputerName and GetUserName:
cUser=Space(32)
nSize=Len(cUser)
Declare Integer GetUserName In Win32API String@, Integer@
nResult=GetUserName(@cUser, @nSize)

cStation=Space(32)
nSize=Len(cStation)
Declare Integer GetComputerName In Win32API String@, Integer@
nResult=GetComputerName(@cStation, @nSize)
Both of these should return 1 if ok. If they return zero (false), then check the value of nSize (this will tell you how big the string needs to be) and try again with string the size of (nSize+1).


>Hi,
>
>I've found a problem with the SYS(0) function. I work on an in-house database system, which most users use in a network setting, with a few working on stand-alone computers.
>
>I've been using SYS(0) to get the user and computer names which has been working fine until now. One of the stand-alone users had a problem with copying files from their computer to another and had to restart their computer. After that, we found that the SYS(0) function is returning a blank for the username.
>
>Does anyone know where SYS(0) looks? Alternatively, is there another way of getting this information?
>
>Thanks,
>
>Stewart
Nigel B Coates
NBC Software Services
Dublin, Ireland.
eMail: Nigel.Coates@NBCSoftware.com
Previous
Reply
Map
View

Click here to load this message in the networking platform