|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Process.RedirectStandardOutput problemredirect the output. I want to be able to get the output continuously so I can update the GUI. But it seems to "spit out" the StandardOutput only in large chunks. Here's my code... can someone give me some idea why it's doing this and if it can be fixed? Private Sub BurnCD(ByVal state As Object) Dim args As String = state Dim tmp As String = "" Dim buf() As Char = {""} BurnStartInfo.Arguments = args BurnProcess.Start() Dim sr As System.IO.StreamReader = BurnProcess.StandardOutput While sr.Peek > 0 Try sr.Read(buf, 0, 1) tmp += buf(0) Debug.WriteLine(tmp) Catch ex As Exception Debug.WriteLine(ex.Message) End Try If tmp.EndsWith(vbCrLf) = True Then lblMsg.Text = tmp tmp = "" End If If tmp.EndsWith("done") Then lblProgress.Text = Val(tmp) tmp = "" End If End While sr.Close() BurnProcess.WaitForExit() End Sub *** Sent via Developersdex http://www.developersdex.com *** Terry,
I had once some problems with the peek, while this one was working. http://www.vb-tips.com/default.aspx?ID=1f8f3eaf-27a1-40d7-9e0b-23cab5aa1049 (be aware that we at the moment are very consequently refresing the site so it can be a while not be there). I hope this helps, Cor Show quoteHide quote "Terry Olsen" <tolse***@hotmail.com> schreef in bericht news:uwQfviQgGHA.4940@TK2MSFTNGP05.phx.gbl... > I'm trying to use the CDBURN.EXE from the SDK. I start the process and > redirect the output. I want to be able to get the output continuously so > I can update the GUI. But it seems to "spit out" the StandardOutput only > in large chunks. Here's my code... can someone give me some idea why > it's doing this and if it can be fixed? > > Private Sub BurnCD(ByVal state As Object) > Dim args As String = state > Dim tmp As String = "" > Dim buf() As Char = {""} > > BurnStartInfo.Arguments = args > BurnProcess.Start() > Dim sr As System.IO.StreamReader = BurnProcess.StandardOutput > While sr.Peek > 0 > Try > sr.Read(buf, 0, 1) > tmp += buf(0) > Debug.WriteLine(tmp) > Catch ex As Exception > Debug.WriteLine(ex.Message) > End Try > > If tmp.EndsWith(vbCrLf) = True Then > lblMsg.Text = tmp > tmp = "" > End If > > If tmp.EndsWith("done") Then > lblProgress.Text = Val(tmp) > tmp = "" > End If > End While > sr.Close() > BurnProcess.WaitForExit() > > End Sub > > *** Sent via Developersdex http://www.developersdex.com ***
VB.NET events creates a hidden delegate, but how do I access it?
Console app no accessible 'Main' method with an app... CurrencyManager Question How to use the httpwebrequest with Cookies in "GET" method current function / sub name ? why are there still COM controls in VS.Net 2005? datagridview cell - get row/column info for updating data- how? Convert VBScript to Visual Basic .Net LockWindowUpdate VB 2005 Converting IP Address as string to MyIP as IPAddress |
|||||||||||||||||||||||