(I've searched SO answers and found no clear solution to this problem.)
I'm working on a MFC GUI program. This program runs various child programs including console program and shell command script(.cmd).
Initially it displayed one GUI window and one console window (created with AllocConsole
) because there are many console output from the child processes. But many users complained about the console window so we decided to hide the console window.
Firstly tried like below:
if (AllocConsole())
{
::ShowWindow(::GetConsoleWindow(), SW_HIDE);
}
Okay, no console window but there are visible flicker at the console creation time.
I've tried several CreateProcess
options for child process creation to prevent showing of console window altogether but failed at short and I think it is practically impossible.
It is not a big deal. We can ignore temporary window flicker at the startup.
But is it really impossible to hide child console window completely?