我一直在搜索,我似乎无法弄清楚如何获得无线网络的SSID。 tbh我只需要某种形式的唯一标识符,以便在连接到已连接的网络时检测到。我在Visual Basic中编码并使用.net Framework 4.5.2。谢谢
-R
答案 0 :(得分:0)
确定获取当前连接的wifi名称试试这个,
转到NuGet
Package Manager
> Manage NuGet Packages For Solution
。
点击浏览并搜索managedwifi
安装包(应该只有一个)
完成后,请按照我为您做的示例。
Imports System.Collections.ObjectModel
Imports System.Text
Imports NativeWifi
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
''THIS WILL DISPLAY THE CONNECTED WIFI'S NAME ON START UP.
Dim wlan = New WlanClient()
Dim connectedSsids As Collection(Of [String]) = New Collection(Of String)()
For Each wlanInterface As WlanClient.WlanInterface In wlan.Interfaces
Dim ssid As Wlan.Dot11Ssid = wlanInterface.CurrentConnection.wlanAssociationAttributes.dot11Ssid
connectedSsids.Add(New [String](Encoding.ASCII.GetChars(ssid.SSID, 0, CInt(ssid.SSIDLength))))
For Each item As String In connectedSsids
Label1.Text = item ''CHANGE THE LABEL TO A TEXTBOX OR WHERE EVER YOU WANT TO DISPLAY YOUR CONNECTED WIFI'S NAME.
Next
Next
''CONTINUE ON FROM HERE.
End Sub
End Class
如果您有任何问题,请告诉我,我会尽快回复您 快乐的编码!