简体   繁体   English

如何使用Visual Basic使用.net Framework 4.5.2获取无线SSID

[英]How to get the Wireless SSID using Visual Basic using .net framework 4.5.2

I have been searching for a while and I can't seem to figure out how to get the SSID of a wireless network. 我已经搜索了一段时间,但似乎无法弄清楚如何获取无线网络的SSID。 tbh I just need some form of unique identifier so that I detect when I connect to a network that I have already connected to. 我只需要某种形式的唯一标识符,以便在连接到已经连接的网络时进行检测。 I'm coding in Visual Basic and using the .net Framework 4.5.2. 我在Visual Basic中编码,并使用.net Framework 4.5.2。 Thanks 谢谢

-R -R

OK to get the current connected wifi's name try this, 单击确定以获取当前连接的wifi的名称,

Go to NuGet Package Manager > Manage NuGet Packages For Solution . 转到NuGet Package Manager > Manage NuGet Packages For Solution click on Browse and search for managedwifi Install the package (There should only be one) 单击浏览并搜索managedwifi安装程序包(应该只有一个)

Once thats done, Follow this example I have made for you. 完成后,请按照我为您制作的此示例进行操作。

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

If you have any issues, let me know and I will do my best to reply to you quickly. 如果您有任何问题,请告诉我们,我们将尽力尽快答复您。
Happy Coding! 编码愉快!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM