获得无线信号强度

有没有办法获得C#中的无线信号强度? 目前我正在通过

Process proc = new Process(); proc.StartInfo.CreateNoWindow = true; proc.StartInfo.FileName = "netsh"; proc.StartInfo.Arguments = "wlan show interfaces"; proc.StartInfo.RedirectStandardOutput = true; proc.StartInfo.UseShellExecute = false; proc.Start(); 

然后通过读取输出来获得无线信号强度。 有没有更好的办法? 最好使用API

Solutions Collecting From Web of "获得无线信号强度"

为什么不使用WMI查询来以干净的方式获取?

 private double RetrieveSignalString() { double theSignalStrength = 0; ConnectionOptions theConnectionOptions = new ConnectionOptions(); ManagementScope theManagementScope = new ManagementScope("root\\wmi"); ObjectQuery theObjectQuery = new ObjectQuery("SELECT * FROM MSNdis_80211_ReceivedSignalStrength WHERE active=true"); ManagementObjectSearcher theQuery = new ManagementObjectSearcher(theManagementScope, theObjectQuery); try { //ManagementObjectCollection theResults = theQuery.Get(); foreach(ManagementObject currentObject in theQuery.Get()) { theSignalStrength = theSignalStrength + Convert.ToDouble(currentObject["Ndis80211ReceivedSignalStrength"]); } } catch (Exception e) { //handle } return Convert.ToDouble(theSignalStrength); } 

请参阅此了解更多信息。 http://social.msdn.microsoft.com/Forums/en-US/34a66ee5-34f8-473d-b6f2-830a14e2300b/get-signal-strength-in-c