Mark,
I have created a simple quick-and-dirty demo for you on how to catch the return code and redirect console messages into out.txt (from a "Run Program..." command):
http://www.lindersoft.com/projects/markd.zip
Unzip the archive and compile and RUN the "MarkD.sb8" project file. It will launch a dummy "console1.exe" and displays its exit code (should display "951"). The redirection writes "Hello, this is a test output from a Win32 console app." to a "out.txt" ASCII text file. This method "should" work fine with DOS, Win32/64 and MFC console apps. But no guarantee because it depends on a secret/undocumented Windows feature
Friedrich