Timer的参数值该如何设呢?interval是整型的,有上限,才1分多钟:(

解决方案 »

  1.   

    那就用Time值取得时间,再用Timer控件检测是否比原来Time值的多了多少,
    还可以用一个Long型值来记录,每调用一次Timer事件就加一,到60的时候就一个小时了。
      

  2.   

    interval设为1000!Private Sub Timer1_Timer()
      If Minute(Time)=0 Ehen
        MsgBox "……"
      End If
    End Sub
      

  3.   

    其实,用timer,定时保存和读取注册表,用注册表的值来控制也是个办法。
      

  4.   

    用timer,定期保存和读取注册表,也是可以实现的。
      

  5.   

    那么这么全局的Timer对象该如何设呢?
      

  6.   

    interval设为1000!Private NowMinute As LongPrivate Sub Command1_Click()
      NowMinute=Minute(Time)
      
    End SubPrivate Sub Timer1_Timer()
      If Minute(Time)=NowMinute Ehen
        MsgBox "……"
      End If
    End Sub
      

  7.   

    'timer控件必须放在一个窗口容器上.
    Private Sub Form_Load()
        Timer1.Interval = 1000
    End SubPrivate Sub Timer1_Timer()
    Static i As Long
        i = i + 1
        If i = 60 Then
            i = 0
            MsgBox "到一小时了."
        End If
        
    End Sub
      

  8.   


    'timer控件必须放在一个窗口容器上.
    Private Sub Form_Load()
        Timer1.Interval = 1000
    End SubPrivate Sub Timer1_Timer()
    Static i As Long
        i = i + 1
        If i = 60 Then
            i = 0
            MsgBox "到一小时了."
        End If
        
    End Sub
      

  9.   

    可以不用窗口.Copy the following code to the Code window of Module1:
      
         Option Explicit      Declare Function SetTimer Lib "user32" _
                (ByVal hwnd As Long, _
                ByVal nIDEvent As Long, _
                ByVal uElapse As Long, _
                ByVal lpTimerFunc As Long) As Long      Declare Function KillTimer Lib "user32" _
                (ByVal hwnd As Long, _
                ByVal nIDEvent As Long) As Long      Global iCounter As Integer      Sub TimerProc(ByVal hwnd As Long, _
                         ByVal uMsg As Long, _
                         ByVal idEvent As Long, _
                         ByVal dwTime As Long)          iCounter = iCounter + 1
              Form1.Text1.Text = CStr(iCounter)
          End Sub
     
    Copy the following code to the Code window of Form1:      Option Explicit
          Dim lngTimerID As Long
          Dim BlnTimer As Boolean      Private Sub Form_Load()
             BlnTimer = False
             Command1.Caption = "Start Timer"
          End Sub      Private Sub Command1_Click()
          'Starts and stops the timer.         If BlnTimer = False Then
                lngTimerID = SetTimer(0, 0, 200, AddressOf TimerProc)
                If lngTimerID = 0 Then
                  MsgBox "Timer not created. Ending Program"
                  Exit Sub
                End If
                BlnTimer = True
                Command1.Caption = "Stop Timer"
             Else
                lngTimerID = KillTimer(0, lngTimerID)
                If lngTimerID = 0 Then
                   MsgBox "couldn't kill the timer"
                End If
                BlnTimer = False
                Command1.Caption = "Start Timer"
              End If      End Sub
      

  10.   

    我已经解决。不过我把interval设为60000。采用的是分儿的方法。一并谢谢以上各位朋友。我是新手,没什么分,将就点吧,别嫌少。