Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myProcess As Process = New Process
' set the file name and the command line args
myProcess.StartInfo.FileName = "notepad.exe"
myProcess.StartInfo.Arguments = "e:\ew.txt"
' start the process in a window
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.normal
myProcess.StartInfo.CreateNoWindow = False
myProcess.Start()
' if the process doesn't complete within
' 600 seconds, kill it
myProcess.WaitForExit(600000)
If Not myProcess.HasExited Then
myProcess.Kill()
End If
' display exit time and exit code
TextBox1.Text = myProcess.ExitCode
TextBox2.Text = myProcess.ExitTime
myProcess.Close()
End Sub
Dim myProcess As Process = New Process
' set the file name and the command line args
myProcess.StartInfo.FileName = "notepad.exe"
myProcess.StartInfo.Arguments = "e:\ew.txt"
' start the process in a window
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.normal
myProcess.StartInfo.CreateNoWindow = False
myProcess.Start()
' if the process doesn't complete within
' 600 seconds, kill it
myProcess.WaitForExit(600000)
If Not myProcess.HasExited Then
myProcess.Kill()
End If
' display exit time and exit code
TextBox1.Text = myProcess.ExitCode
TextBox2.Text = myProcess.ExitTime
myProcess.Close()
End Sub