http://expert.csdn.net/TopicView.asp?id=13411

解决方案 »

  1.   

    这个vb程序为何导致死机?
    程序的功能是每隔半分钟就运行一次webbrowser.exe(浏览一个网址),5秒钟后关闭浏览器,这个程序从8:00到17:00一直在运行,但运行六个小时后死机了?请问是什么原因?没有真正结束webbrowser.exe?Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    Dim num As Integer
    Private Sub Form_Load()
    Timer1.Interval = 5000
    Timer1_Timer
    End SubPrivate Sub Timer1_Timer()
       Static sngOldTime As Single
        Dim sngt As Single
        sngt = Timer
        If sngt >= 8 * 3600! Then
        
                     
        
            If sngt < 18 * 3600! Then
            
            If Abs(sngt - sngOldTime) >= 30 Then
             
                      sngOldTime = sngt
                      num = num + 1
                    Label1.Caption = num
               i = Shell("f:\webbrowser.exe", 1)
               '执行webbrowser.exe这个程序
               Sleep 50000
                pausetask "webbrowser"
                '关闭这个程序
                End If
                
            End If
        End If