Hello there. I am doing an update for my software, PerfectCompress. The program launches exe files to compress a file, for example, if the user is going to compress to PAQ8PX, the software will open paq8px.exe. The problem is that these opens in a command line window. I have found this code to redirect the command line window to a RichTextBox, however, the software does not ends and it is supposed to end. I have a looping process so the software can update the RichTextBox but when the compression finish, the RichTextbox just writes blank lines and do not end the compression software.
The code is as follows:
Please help me. I write this because I don't want Command prompt windows to pop-up. Instead, I want everithing to be displayed on the program RichTextBox.Code:Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim PAQExe As String = "paq8px_v60.exe" Dim PAQDir As String = "" Dim PAQ As New ProcessStartInfo Dim StartPAQ As Process Dim sLine As String PAQ.WorkingDirectory = PAQDir PAQ.FileName = PAQExe PAQ.Arguments = "-5 """ & TextBox2.Text & """ """ & TextBox1.Text & """" PAQ.UseShellExecute = False 'required to redirect PAQ.RedirectStandardInput = True PAQ.RedirectStandardOutput = True PAQ.CreateNoWindow = True 'creates no cmd window Try StartPAQ = Process.Start(PAQ) Do sLine = StartPAQ.StandardOutput.ReadLine RichTextBox1.Text += sLine & vbNewLine RichTextBox1.Refresh() Loop StartPAQ.WaitForExit() Catch ex As Exception RichTextBox1.AppendText(ex.Message) End Try End Sub End Class

Reply With Quote