Hello everyone, what i am trying to accomplish is execute a dos command with the following code:
frmStatusBar.Show()
' Set start information.
Dim start_info As New ProcessStartInfo(sOutput)
With start_info
.UseShellExecute = False
.CreateNoWindow = True
.RedirectStandardOutput = True
.RedirectStandardError = True
.WorkingDirectory = Exec_Path
.Arguments = sParam
End With
' Make the process and set its start information.
Dim proc As New Process()
proc.StartInfo = start_info
proc.EnableRaisingEvents = True
frmOutput.txtOutput.Text = ""
frmOutput.txtCommand.Text = ""
frmOutput.txtError.Text = ""
frmOutput.txtCommand.Text = sOutput & " " & sParam
' Start the process.
proc.Start()
' Attach to stdout and stderr.
Dim std_out As StreamReader = proc.StandardOutput()
Dim std_err As StreamReader = proc.StandardError()
' Display the results.
frmOutput.txtOutput.Text = std_out.ReadToEnd() & vbCrLf
frmOutput.txtError.Text = std_err.ReadToEnd() & vbCrLf
Application.DoEvents()
' Clean up.
std_out.Close()
std_err.Close()
proc.Close()
If Len(Dir(Exec_Path & "\eboot.pbp")) = 0 Then
ExecuteDOS = False
Exit Function
End If
frmStatusBar.Close()
ExecuteDOS = True
and then display a progressbar while it is executing so that the user does not think that the app is locked up.
frmStatusBar.Show()
' Set start information.
Dim start_info As New ProcessStartInfo(sOutput)
With start_info
.UseShellExecute = False
.CreateNoWindow = True
.RedirectStandardOutput = True
.RedirectStandardError = True
.WorkingDirectory = Exec_Path
.Arguments = sParam
End With
' Make the process and set its start information.
Dim proc As New Process()
proc.StartInfo = start_info
proc.EnableRaisingEvents = True
frmOutput.txtOutput.Text = ""
frmOutput.txtCommand.Text = ""
frmOutput.txtError.Text = ""
frmOutput.txtCommand.Text = sOutput & " " & sParam
' Start the process.
proc.Start()
' Attach to stdout and stderr.
Dim std_out As StreamReader = proc.StandardOutput()
Dim std_err As StreamReader = proc.StandardError()
' Display the results.
frmOutput.txtOutput.Text = std_out.ReadToEnd() & vbCrLf
frmOutput.txtError.Text = std_err.ReadToEnd() & vbCrLf
Application.DoEvents()
' Clean up.
std_out.Close()
std_err.Close()
proc.Close()
If Len(Dir(Exec_Path & "\eboot.pbp")) = 0 Then
ExecuteDOS = False
Exit Function
End If
frmStatusBar.Close()
ExecuteDOS = True
and then display a progressbar while it is executing so that the user does not think that the app is locked up.