Something like this...
Code:
#include <sstream> //for VC++ 6.0
#include <strstream>
  ....
    if (!SetStdHandle(STD_OUTPUT_HANDLE, hSaveStdout)) 
    {
        std::ostringstream msg;

        msg << "SetStdHandle(STD_OUTPUT_HANDLE, hSaveStdout) Failed" << endl
            << "GetLastError() = " << GetLastError();

        MessageBox(NULL, 
                   msg.str().c_str(),
                   "Debug", 
                   MB_OK | MB_ICONSTOP);

        return result; 
    }
For all the return spots after CreateProcess() call.

gg