Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get my IP Address
Message
From
04/03/2010 22:04:33
Neil Mc Donald
Cencom Systems P/L
The Sun, Australia
 
 
To
04/03/2010 07:00:57
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01452426
Message ID:
01452669
Views:
44
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
Previous
Reply
Map
View

Click here to load this message in the networking platform