Browse Source

Added some init code to enable stdout, stderr, stdin in the special case that we run an non-console Windows app inside a Windows console such as cmd.exe or PowerShell.

tags/2021-05-28
Timur Doumler 9 years ago
parent
commit
4c900be00a
1 changed files with 10 additions and 0 deletions
  1. +10
    -0
      modules/juce_events/messages/juce_ApplicationBase.cpp

+ 10
- 0
modules/juce_events/messages/juce_ApplicationBase.cpp View File

@@ -257,6 +257,16 @@ bool JUCEApplicationBase::initialiseApp()
}
#endif
#if JUCE_WINDOWS && JUCE_STANDALONE_APPLICATION && ! defined (_CONSOLE)
if (AttachConsole (ATTACH_PARENT_PROCESS) != 0)
{
// if we've launched a GUI app from cmd.exe or PowerShell, we need this to enable printf etc.
freopen("CON", "w", stdout);
freopen("CON", "w", stderr);
freopen("CON", "r", stdin);
}
#endif
// let the app do its setting-up..
initialise (getCommandLineParameters());


Loading…
Cancel
Save