vb编程wifi
Public a, e, f As Integer, b, c, d As String
Private Sub Command1_Click()
b = Text1.Text
c = Text2.T ext
d = "netshwlan set hostednetwork mode=allow"
If b = "" Or c = "" Then
MsgBox "请填写新建网络名和密码!", 48, "错误"
Else
If Len(c) >= 8 Then
Open "D:\wifibuild.bat" For Output As #1
Print #1, "netshwlan set hostednetwork mode=allow", "ssid="; b, "key="; c Print #1, "netshwlan start hostednetwork"
Close #1
Shell "explorer.exe" & "D:\wifibuild.bat", 1
Label5.Caption = "已连接"
Timer1.Enabled = False
Else
MsgBox "密码至少为8位", 48, "提示"
End If
End If
End Sub
Private Sub Form_Load()
a = 0
e = 0
f = 0
End Sub
Private Sub Form_Unload(Cancel As Integer)
If Dir("D:\wifibuild.bat") <> "" Then Kill "D:\wifibuild.bat"
End If
End Sub
Private Sub Option1_Click()
Text1.PasswordChar = ""
End Sub
Private Sub Option2_Click()
Text1.PasswordChar = "*"
End Sub
Private Sub Timer1_Timer()
r: a = a + 1
If a = 60 Then
e = e + 1
a = -1
GoTo r
End If
If e = 60 Then
f = f + 1
e = 0
End If
Label6.Caption = f & "小时" & e & "分钟" & a & "秒" End Sub