我想设为30分钟。谢谢!

解决方案 »

  1.   

    'This project needs a button
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    Private Sub Command1_Click()    Me.Caption = "Your system will sleep 5 sec."
        'Sleep for 5000 milliseconds
        Sleep 5000
        Me.Caption = ""
    End Sub
    Private Sub Form_Load()
        Me.Caption = ""
        Command1.Caption = "Sleep ..."
    End Sub
      

  2.   

    不好!
    1)我想要根据时间自动触发,用 button 还要 timer 干啥?!2)不能让机器 sleep, 因为还要在程序中作另外的事。打个比方:我希望想 outlook 一样,能每隔 30 分钟自动检查新邮件,而不影响其它程序的运行!
      

  3.   

    这里提供一个能用的方法,任何时间都可以:option explicit
    dim T1 as long
    dim T2 as long
    const T =30 Form_load时
       T1 = hour(now)*3600 + minute(now)*60 + second(now)Timer1_Timer()
       T2 =hour(now)*3600 + minute(now)*60 + second(now)
       if abs(T2-T1) >= T*30 then
          T2=T1
          msgbox "你想做什么,现在就做吧!"
       end if
      

  4.   

    作一点修改:
     if abs(T2-T1) >= T*60 then
      

  5.   

    Timer 第一次触发时,把当前时间记下来;然后要Timer 每隔1秒触发一次:比较当前时间与第一次时间是否间隔30分钟
      

  6.   

    不如用个笨法子吧:(Timer1.Interval = 60000   一分钟)
    Option Explicit
    Dim i As Integer’-------------------------------------------------
    Private Sub Timer1_Timer()
        i = i + 1
        If i = 30 Then 
            Msgbox"时间到!"
            i = 0   '重新记数
        End If
    End Sub
      

  7.   

    用GetTickCount
    在timer中检查间隔的值