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 = ''
ENDIFEMail: 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