Doevents and Piping/redirecting Win32 Console Output
I am trying to write a front end for a console app (the app is besweet, used to decode DVD audio). In order to provide the status of the decoding I pipe the output of the program in to a textbox
Part of the code that I use to do this is below, my problem is with DoEvents. The console program initially seems to do nothing and no output is displayed but then if I move the mouse or click something or break to the IDE and resume it starts to work as intended. Removing the Doevents fixes this but then obviously the program becomes locked while the decoding takes place. Does anyone have any ideas about why this might be or how to fix this.
VB Code:
'strresult holds output
'trimlines processes the output to make it suitable for the textbox,
Do While ReadFile(hRead, lpBuffer(0), 256, bRead, ByVal 0&)
strresult = strresult & StrConv(lpBuffer(), vbUnicode)
txt = trimlines(strresult)
DoEvents
Erase lpBuffer()
If bRead <> 256 Then Exit Do
Loop