Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to determine if network connection is wireless?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01320916
Message ID:
01321089
Views:
20
>Anyone know how to detect if a computer is using a wireless (vs wired) connection?

You could try something like this
clear
loLocator		= CREATEOBJECT('WBEMScripting.SWBEMLocator')
loWMI			= loLocator.ConnectServer()
loNAs			= loWMI.ExecQuery('Select * from Win32_NetworkAdapter where NetConnectionStatus is not null')
for each loNA in loNAs
	with loNA
		? .Caption, .AdapterType, .AdapterTypeID, .DeviceID, .MACAddress, .NetConnectionStatus
	endwith
endfor

* Now, AdapterTypeID = 9 is Wireless, so if you are interested only to see if some wireless connection exists you can do something like
clear
loLocator		= CREATEOBJECT('WBEMScripting.SWBEMLocator')
loWMI			= loLocator.ConnectServer()
loNAs			= loWMI.ExecQuery('Select * from Win32_NetworkAdapter where NetConnectionStatus is not null and AdapterTypeID=9')
? iif(loNAs.Count = 0, 'No', transform(loNAs.Count)) + ' wireless adapter(s) detected'
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Reply
Map
View

Click here to load this message in the networking platform