Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sys(0)- does it now work??
Message
From
01/07/1998 00:18:17
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00113097
Message ID:
00113251
Views:
18
>>In Fox 2x there was a know problem with sys(0) in that it did not recognize some configurations of Novell. Has this problem been fixed to the point that I can be confident that Sys(0) will always tell me the network name of a computer? Thanks... Calvin
>
>In VFP, You'd be better off calling the API function GetComputerName:
>
>FUNCTION GetCompName
>* Declare the API function
>DECLARE INTEGER GetComputerName IN Win32API ;
>   STRING  @cComputerNameBuffer, ;
>   INTEGER @nLengthOfName
>LOCAL cMyBuffer, nBufferLen, nResult, cReturnVal
>*
>*  Create a fixed-length buffer to hold result;  we'll examine the buffer length
>*   after the call to see how long the name really is - under Win32, it shouldn't exceed 15 chars + null
>*
>cMyBuffer = SPACE(255)+CHR(0)
>nBufferLen=256
>*
>*  Note how seriously I believe the values in the VC .h files!
>*
>nResult = GetComputerName(@cMyBuffer, @nBufferLen)
>IF nResult = 1
>   cReturnVal=STRTRAN(LEFT(cMyBuffer,nBufferLen),CHR(0),'')
>ELSE
>   cReturnVal = ''
>ENDIF
>RETURN cReturnVal
>
Sys(0) has worked for me quite well. Another thing I get from using it is the current user name if on network environment (which is 100% of the time). Can you post corresponding API (for getting user name that is)? TIA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform