开发者

Connect to an available wireless network using VB.NET

Using VB.NET how do I connect to an available wireless network. 开发者_运维问答I have been able to list all the available networks.


Assuming you are wanting to control the Windows biult-in wifi stack, you should be able to do it with the WlanConnect Function. A signature is availeble at pinvoke.net.

MSDN has a list of the articles pertaining to wifi here.

The MSDN page does not say whether this is the case, but an application might need elevated permissions to use this API...


If you have the WLAN profile saved in your PC, this approach is simple.

Sub connectTo(ByVal name As String)
    Dim p = "netsh.exe"
    Dim sInfo As New ProcessStartInfo(p, "wlan connect " & name)
    sInfo.CreateNoWindow = True
    sInfo.WindowStyle = ProcessWindowStyle.Hidden
    Process.Start(sInfo)
End Sub

'use the sub to connect to your AP. connectTo("myAP")

Otherwise, it is easier to use ManagedWifi or SimpleWifi dll libraries. Here is my code where I used SimpleWifi.dll to connect to a network with a passkey.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜