How to execute child console programs without showing the console window from the Win32 GUI program? How to execute child console programs without showing the console window from the Win32 GUI program? windows windows

How to execute child console programs without showing the console window from the Win32 GUI program?


Setup the STARTUPINFO like this for the CreateProcess call:

    STARTUPINFO si = { 0 };    si.cb = sizeof(si);    si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;    si.hStdInput = GetStdHandle(STD_INPUT_HANDLE);    si.hStdOutput =  GetStdHandle(STD_OUTPUT_HANDLE);    si.hStdError = GetStdHandle(STD_ERROR_HANDLE);    si.wShowWindow = SW_HIDE;