比如在程序启动后1小时后关闭。

解决方案 »

  1.   

    Dim elapsetime As Long
    Private Sub Form_Load()
    Timer1.Enabled = True
    Timer1.Interval = 30000
    elapsetime = 0
    End SubPrivate Sub Timer1_Timer()
    elapsetime = elapsetime + 1
    If elapsetime = 120 Then End
    End Sub
      

  2.   

    Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As LongSub TimerProc(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long)
        End
    End SubSub Main()
        SetTimer 0, 0, 3600000, AddressOf TimerProc  '1×60×60×1000=3600000
        Form1.Show
    End Sub