问题描述:
Private Sub Command1_Click()
Dim aaa As String
aaa = "Rasdial" & " " & Text2.Text & " " & Text3.Text & " " & Text4.Text
Shell aaa, 6
End Sub
Private Sub Command2_Click()
Dim bbb As String
bbb = "Rasdial" & " " & Text2.Text & " " & "/Disconnect"
Shell bbb, 6
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub Timer1_Timer()
Form2.Show
End Sub
text1 为 拨号程序的名称
text2 为 adsl帐号
text3 为 密码
现在我用 按纽实现了 拨号,短网的功能.
但是我想实现, 用timer控件,运行软件开始 拨号.20秒后断网.断网后1秒开始重新拨号...应该如何实现.高手来啊
另外找个师傅..各位师傅留下QQ啊
问题解答:
Private Sub Command1_Click()
Dim aaa As String
aaa = "Rasdial" & " " & Text2.Text & " " & Text3.Text & " " & Text4.Text
Shell aaa, 6
End Sub
Private Sub Command2_Click()
Dim bbb As String
bbb = "Rasdial" & " " & Text2.Text & " " & "/Disconnect"
Shell bbb, 6
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub Form_Load()
Timer1.Interval = 1000
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Static n As Integer
n = n + 1
If n = 1 Then Command1.Value = True
If n = 21 Then
Command2.Value = True
n = 0
End If
End Sub
Option Explicit
Private Sub Form_Load()
Timer1.Enabled = True
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
Static T As Long
If T = 0 Then
Shell "Rasdial" & " " & Text2.Text & " " & Text3.Text & " " & Text4.Text, 6 T = 1
ElseIf T = 20 Then
Shell "Rasdial" & " " & Text2.Text & " " & "/Disconnect", 6
T = 0
Else
T = T + 1
End If
End Sub