vb6.0 实现长时间定时操作?

来源:百度知道 编辑:UC知道 时间:2024/06/11 18:11:27
在vb6.0里面,timer控件的时间间隔最长大约为1分钟左右,而我想实现的定时操作大概为10分钟左右,这该怎么办呢?

间隔设置为30秒
private sub Timer1_Timer()
static n as integer
n=n+1
if n mod 20 = 0 then'10分钟
msgbox "ok"
end if
end sub

Dim StartT as Date
Private Sub COmmand1_Click()
StartT=Now
Timer1.Enabled=True
End Sub

Private Sub Timer1_Timer()
'设置Interval属性为1000
If Now-StartT=10/(24*60) Then '10分钟执行一次
执行你的事件代码
StartT=Now
End If
End Sub