Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting System Info
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00096957
Message ID:
00096976
Vues:
14
>Sawadee Kahp,
>
> I've looked through all the SYS commands but I can't find anything to give me the name of the computer. Is there an equivalent command to UNIX style uname -a ? I need the complete LAN path.
>

Take a look at the API; to retrieve the machine name, see the code below. If you need to extract share names and the like, there are other calls to resolve UNCs from mapped paths, etc.


DECLARE INTEGER GetComputerName IN Win32API ;
STRING @cComputerNameBuffer, ;
INTEGER @nLengthOfName

* Retrieves the ComputerName in use presently - safer than using the registry
* entry, since it mught have been reset for the next boot
LOCAL cMyBuffer, nBufferLen, nResult, cCompName
* 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
cMyBuffer = SPACE(255)+CHR(0)
nBufferLen=256
nResult = GetComputerName(@cMyBuffer, @nBufferLen)
IF nResult = 1
cCompName=STRTRAN(LEFT(cMyBuffer,nBufferLen),CHR(0),'')
ELSE
cCompName = ''
ENDIF
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform