Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to get computer name from system
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00505117
Message ID:
00506639
Views:
18
Thanks for the post!
>>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
Imagination is more important than knowledge
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform