Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Get my IP Address
Message
De
04/03/2010 22:04:33
Neil Mc Donald
Cencom Systems P/L
The Sun, Australie
 
 
À
04/03/2010 07:00:57
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01452426
Message ID:
01452669
Vues:
45
Hi,
This is what I use
Local oServer, oAdapters, oAdapter

oServer = Getobject("winmgmts:\\" + "." + "\root\cimv2")
oAdapters = oServer.ExecQuery(;
	"SELECT * FROM Win32_NetworkAdapterConfiguration")

Create Cursor csResult (;
	ObjectCaption C(50),;
	Gateway C(50),;
	IPAddress C(20),;
	MACAddress C(20),;
	IPXAddress C(20),;
	ServiceName C(50),;
	DHCPServer C(50),;
	DNSHostName C(50);
	)

Local cGateway

For Each oAdapter In oAdapters
	With oAdapter
		If .IPEnabled

			cGateway = Iif(Isnull(.DefaultIPGateway), "",;
				.DefaultIPGateway[0])

			Insert Into csResult Values (;
				NVL(.Caption, ""),;
				NVL(cGateway, ""),;
				NVL(.IPAddress[0], ""),;
				NVL(.MACAddress, ""),;
				NVL(.IPXAddress, ""),;
				NVL(.ServiceName, ""),;
				NVL(.DHCPServer, ""),;
				NVL(.DNSHostName, "");
				)

		Endif
	Endwith
Next

Select csResult
Go Top
Browse Normal Nowait
>Hi Al,
>
>How can I know my IP address from VFP? I have code for using the WBEM Scripting Object to interogate the network card but not sure how to get the IP address.
>
>TIA.
Regards N Mc Donald
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform