Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting the IP address or Network User Name
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00529879
Message ID:
00529888
Views:
8
>Is there any way of returning the IP address (IP addresses are static per machine) or network use name of a machine?
>
>Colin Northway

PC IP address:
oIP = createobject('MSWinsock.Winsock')
lcIP = oIP.LocalIP()
The user name:
* Function UserName
* Returns Windows user name
*
local lcBuffer, lnSize, lnRetCode, lcUserName
lcBuffer = repl(chr(0),64)
lnSize = LEN(lcBuffer) -1
Declare Long WNetGetUserA in "mpr.dll" As GetUserName ;
				STRING @lc0, STRING @lcBuffer, LONG @lnSize
lnRetCode = GetUserName("", @lcBuffer, @lnSize )
lcUserName = left(lcBuffer, at(chr(0), lcBuffer)-1)
return lcUserName
The machine name
lcTemp = SYS(0)
lcMachName = left(lcTemp, At("#", lcTemp)-1)
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform