Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to get computer name from system
Message
 
 
To
08/05/2001 23:56:41
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00505117
Message ID:
00506463
Views:
20
>I am wondering how to get the computer name from the system. This will need to work on windows 95, 98, Nt, 2000 whether connected to a network or not.
>
>I am planning on using this for a simple software copy protection. Is there any other pieces of system information that would also prove useful instead of or in addition to the computer name.
>
>Jason

Jason, here's something I have used:
    local lcMachineName,lnLen,llRetVal
    declare GetComputerName in WIN32API string @,long @
    lcMachineName=space(200)
    lnLen=200
    llRetVal=GetComputerName(@lcMachineName,@lnLen) && Local computer name from registry
*    public IPSocket
*    IPSocket = CreateObject("MSWinsock.Winsock")
*    if type('IPSocket')='O'
*      IPAddress = IPSocket.LocalIP
*      localhostname=IPSocket.localhostname
*    endif
* Email MIS
*    cemailline1="Error in TT3 Active Program "+mprog+ " err "+ cmerror+ CHR(10)+CHR(13)
    cemailline12="Network Information "+iif(llRetval,left(alltr(lcMachineName),len(alltr(lcMachineName))-1),.Null.)
*    cemailline13="Local IP:   " + IPAddress
*    cemailline14="Local host: "+localhostname
Ed B
Edgar L. Bolton, B.S. B.B.A.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform