Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to determine if network connection is wireless?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01320916
Message ID:
01321089
Vues:
21
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform