在VB6中,我用到timer控件,不能将Interval设置到1小时,并且时间的精确性也差,因此考虑用API函数,但对这个函数极其陌生,请各位高手帮帮忙,些段代码,谢谢!我用的timer控件写的内容大致为:Private Sub Command1_Click()
    Command2.Visible = True 
    Image2.Visible = True
If IsNumeric(Text1.Text) = True Then
    Timer1.Interval = Val(Text1.Text) * 1000
End If
    Timer1.Enabled = True
End Sub
------------------------------------------------
Private Sub Command2_Click()
    Command2.Visible = False
    Image2.Visible = False    '停止图标
    Timer1.Enabled = False
End Sub
------------------------------------------------
Private Sub Form_Load()
Command2.Visible = False  '停止按钮     
Timer1.Enabled = False 
End Sub
------------------------------------------------
Private Sub Timer1_Timer()
    MsgBox ("成功")
End Sub

解决方案 »

  1.   

    本帖最后由 bcrun 于 2011-09-20 14:25:21 编辑
      

  2.   


    谢谢你的回复,但我没花太多时间在timer控件中了,主要是精确性差,还是想用其他方式实现
      

  3.   

    用hour(now), munite(now) 获得当前小时和分钟
      

  4.   

    在定时器中定时计算时间差,可以用datediff函数。
      

  5.   

    1、Timer的最大时间间隔是65535ms约等于66秒。
    2、处理大的时间间隔的方法最好就是使用DateDiff函数,具体方法参阅1楼。不过,建议楼主可以把Interval设置的更小(比如:500),这样误差会更小。