If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Threaded View

Reading stdout from VB6

Let me first say i'm a VB6 newbie, so please be kind

I am trying to write a console (dosbox) app monitoring program in VB6 where i can pipe the stdout to my VB app, but i'm having a few problems. I have found several pieces of example code for piping output from console apps, but they all seem to be aimed at firing the app, grabbing a small amount of info from stdout and then closing.

What i need to do is fire up 3 console processes and then periodically check the processes are still running (restarting them if they are not) and grab the stdout from each to place in my output panels in my VB form. All 3 console apps are persistent and are expected to output quite a lot in a short amount of time.

I am starting with just one of the console apps to simplify things until i get it somewhere close to working. I can get the console app started and i'm trying to use a timer to call the stdout grabbing, it works for a few seconds then the VB form freezes until i kill the console. Once the console is gone the VB form unfreezes and dumps the rest of the output where i want it, it does always seem to freeze at about the same spot in the output though even if i change the read buffer size. I have tried different lengths between timer calls (1 second up to 30), and the number of times the timer code is successfully called before lockup varies depending on the timer length.

I've played with several examples now and seem to get the same results from each method i've tried.

Here's the current code i'm playing with (pulled from here somewhere i think)....