1,451
社区成员
发帖
与我相关
我的任务
分享
lCount = Temp15 'lCount 声明成模块级的变量,Long类型
Timer3.Interval = 1000 '设计时确定,可以不要这句
Timer3.Enabled = True
Private Sub Timer3_Timer()
lCount = lCount - 1
if (lCount > 0) then exit sub
Timer3.Enabled = False
............. '你的其它代码....
end sub
Option Explicit
Private m_StopTime As Date
Private Sub Command7_Click()
...
'Timer3.Interval = Temp15 * 1000 改为下面两句->
Timer3.Interval = 500
m_StopTime = DateAdd("s", Val(Temp15), Now)
Timer3.Enabled = True
...
End Sub
Private Sub Timer3_Timer()
If Now() < m_StopTime Then Exit Sub '增加这个判断'
... '到点时的执行代码'
End Sub
Private Sub Timer1_Timer()
Static idx As Long
If idx = 0 Then idx = 1
If idx < a Then '设置a秒执行一次
idx = idx + 1
Else
Timer1.Enabled = False
Dim longth As Integer
If Check1.Value = 1 Then
intOutMode = 1
Else
intOutMode = 0
End If
strSendText = pl.Text + zkb.Text + sq.Text
If intOutMode = 0 Then
Else
longth = strHexToByteArray(strSendText, bytSendByte())
If longth > 0 Then
MSComm1.Output = bytSendByte
End If
End If
Timer1.Enabled = True
idx = 0
End If
End Sub
Option Explicit
Private Declare Function GetTickCount Lib "kernel32" () As Long
Dim lngP As Long
Private Sub Form_Load()
Timer1.Enabled = True
Timer1.Interval = 100
lngP = GetTickCount '记录计时起点
End Sub
Private Sub Timer1_Timer()
If GetTickCount - lngP >= 66000 Then
'添加你的代码
lngP = GetTickCount '记录新的计时起点
End If
End Sub