Private Sub C1_Click()
If Len(Text2.Text) < 8 Then
MsgBox "密码长度必须大于等于8位哦! >0:0<"
Else
Shell "netsh wlan set hostednetwork mode=allow ssid=" + Text1.Text + " key=" + Text2.Text
C1.Caption = "已开启"
C2.Caption = "关闭"
C1.Enabled = False
C2.Enabled = True
Text2.PasswordChar = "*"
C1.Visible = False
C2.Visible = True
MsgBox "Wi-Fi 已成功开启,您的无线设备可以连接 " + Text1.Text + " 上网啦! >o.o<"
Text1.Text = Text1.Text
End If
End Sub
Private Sub C2_Click()
Shell "netsh wlan stop hostednetwork"
C1.Caption = "重新开启"
C2.Caption = "已关闭"
C2.Enabled = False
C1.Enabled = True
C2.Visible = False
C1.Visible = True
MsgBox "Wi-Fi 关闭啦......"
End Sub
Private Sub C3_Click()
If Text3.Text = "" Or Text4.Text = "" Then
MsgBox "你还没有输入时间!"
ElseIf 0 <= Val(Text3.Text) And Val(Text3.Text) <= 23 And 0 <= Val(Text4.Text) And Val(Text4.Text) <= 59 Then
Shell "shutdown -a"
Shell "at " + Text3.Text + ":" + Text4.Text + "shutdown -s"
C4.Visible = True
C3.Visible = False
C4.Enabled = True
If Len(Text3.Text) = 1 Then
Text3.Text = "0" & Int(Text3.Text)
End If
If Len(Text3.Text) = 1 Then
Text4.Text = "0" & Int(Text4.Text)
End If
MsgBox "电脑将在 " + Text3.Text + ":" + Text4.Text + " 自动关机!!!"
Else
MsgBox "错误输入! 输入范围为: 00:00-23:59 "
End If
End Sub
Private Sub C4_Click()
Shell "shutdown -a"
C3.Visible = True
C4.Visible = False
C3.Enabled = True
C4.Enabled = False
MsgBox "自动关机已取消......"
End Sub
Private Sub Check1_Click()
If Check1.Value = 0 Then
Text2.PasswordChar = "*"
ElseIf Check1.Value = 1 Then
Text2.PasswordChar = ""
End If
End Sub
Private Sub Text3_Change()
Text3.MaxLength = 2
If Not IsNumeric(Text3.Text) Then
Text3.Text = ""
End If
End Sub
Private Sub Text3_Click()
If Len(Text4.Text) = 1 Then
Text4.Text = "0" & Int(Text3.Text)
End If
End Sub
Private Sub Text4_Change()
Text4.MaxLength = 2
If Not IsNumeric(Text4.Text) Then
Text4.Text = ""
End If
End Sub
Private Sub Text4_Click()
If Len(Text3.Text) = 1 Then
Text3.Text = "0" & Int(Text3.Text)
End If
End Sub
评论0