本程序是利用vb讀寫文件來實(shí)現(xiàn)的,再通過調(diào)用計(jì)算機(jī)中的explorer運(yùn)行新建的文件,程序思想是通過dos命令建立虛擬無線熱點(diǎn),因此你的計(jì)算機(jī)必須要求帶無線網(wǎng)卡,如果你的計(jì)算機(jī)有無線網(wǎng)卡但不能運(yùn)行,請嘗試升級網(wǎng)卡驅(qū)動。由于運(yùn)行當(dāng)中會調(diào)用explorer程序,和某些計(jì)算機(jī)病毒的投放方法有所相同,所以程序在運(yùn)行時(shí)會引起一些安全軟件的誤判。程序運(yùn)行時(shí)會在C:\Users\Administrator\Documents目錄下生成文件。 還有許多不足,希望大家指出改進(jìn)!
程序源碼如下:
Public a As Integer, e As Integer, f As Integer, b As String, c As String, d As String Private Sub Command2_Click() b = Text1.Text c = Text2.Text d = "netsh wlan set hostednetwork mode=allow" If b = "" Or c = "" Then MsgBox "請?zhí)顚懶陆o線網(wǎng)絡(luò)名稱或密碼!", 48, "錯(cuò)誤!" Else If Len(c) = 8 Then Open "C:\Users\Administrator\Documents\wifibuild.bat" For Output As #1 Print #1, "netsh wlan set hostednetwork mode=allow", "ssid="; b, "key="; c Print #1, "netsh wlan start hostednetwork" Close #1 Shell "explorer.exe " & "C:\Users\Administrator\Documents\wifibuild.bat", 1 Label5.Caption = "已連接" Timer1.Enabled = True Else MsgBox "密碼長度應(yīng)為8位!", 48, "錯(cuò)誤!" End If End If End Sub Private Sub Command3_Click() If Dir("C:\Users\Administrator\Documents\wifibuild.bat") <> "" Then Open "C:\Users\Administrator\Documents\wifiend.bat" For Output As #1 Print #1, "netsh wlan set hostednetwork mode=disallow" Shell "explorer.exe " & "C:\Users\Administrator\Documents\wifiend.bat", 1 Close #1 Timer1.Enabled = False Else MsgBox "您還沒有創(chuàng)建wifi熱點(diǎn)!", 48, "錯(cuò)誤!" 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("C:\Users\Administrator\Documents\wifibuild.bat") <> "" Then Kill "C:\Users\Administrator\Documents\wifibuild.bat" End If If Dir("C:\Users\Administrator\Documents\wifiend.bat") <> "" Then Kill "C:\Users\Administrator\Documents\wifiend.bat" End If End Sub
Private Sub Option1_Click() Text2.PasswordChar = "" End Sub
Private Sub Option2_Click() Text2.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 & "小時(shí)" & e & "分鐘" & a & "秒" End Sub
附圖: 1.未連接 2.已連接 3. 4.打開網(wǎng)絡(luò)和共享中心——》更改適配器設(shè)置,會發(fā)現(xiàn)多了個(gè)無線網(wǎng)絡(luò)連接2 5.設(shè)置寬帶共享 之后你就可以用你的手機(jī)連接你的電腦共享網(wǎng)絡(luò)上網(wǎng),再也不怕月末流量報(bào)警了有木有! 注意: 程序運(yùn)行點(diǎn)擊創(chuàng)建wifi時(shí)會出現(xiàn)如下情況 點(diǎn)允許執(zhí)行就行了,我試過用cmd.exe直接打開新建的文件,好像不行,所以只能用explorer了。
完整的Word格式文檔51黑下載地址:
vb建無線wifi熱點(diǎn)(附圖).doc
(224.5 KB, 下載次數(shù): 16)
2018-11-1 14:24 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
|