Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Strict On
- Imports System.Net.Mail
- Public Class Form1
- Private t As New Threading.Thread(AddressOf Thread)
- Private p As New Process()
- Private test, erfolg, fehlg, neu As Integer
- Private Sub Thread()
- p.StartInfo.FileName = "CGWatcher.exe"
- p.StartInfo.WorkingDirectory = "C:\CGWatcher"
- p.StartInfo.WindowStyle = ProcessWindowStyle.Normal
- p.Start()
- 'Das ist die Zeit bis zum 1. Test in ms, diese Zeit sollte min. 1 Minute betragen, da ein
- 'Programm sich beim starten gern nciht zurückmeldet
- ' Threading.Thread.Sleep(60000)
- Threading.Thread.Sleep(5000)
- While True
- test = test + 1
- If Not p.Responding Then
- Try
- p.Kill()
- p.Start()
- neu = neu + 1
- Catch ex As InvalidOperationException
- p.Start()
- neu = neu + 1
- Catch ex As Exception
- MessageBox.Show(ex.Message & vbCrLf & ex.StackTrace)
- End Try
- fehlg = fehlg + 1
- 'Das ist die Zeit bis zum 1. Test in ms, diese Zeit sollte min. 1 Minute betragen, da ein
- 'Programm sich beim starten gern nciht zurückmeldet
- 'Threading.Thread.Sleep(60000)
- Threading.Thread.Sleep(5000)
- Else
- erfolg = erfolg + 1
- End If
- 'Hier trag ihr ein das alle X ms geprüft werden soll. 1500 sind 1,5 sek. 300000 = 5 Minuten
- 'Threading.Thread.Sleep(300000)
- Threading.Thread.Sleep(5000)
- End While
- End Sub
- Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- t.Start()
- End Sub
- Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
- If t.IsAlive Then
- t.Abort()
- End If
- End Sub
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- Form2.Show()
- End Sub
- End Class
Add Comment
Please, Sign In to add comment