Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting the IP address or Network User Name
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00529879
Message ID:
00529888
Vues:
9
>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--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform