diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-09-09 00:00:26 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-09-09 00:00:26 +0200 |
| commit | c9adcaa9bed0ade0c763c207ee6305a8f397fe41 (patch) | |
| tree | 9ab5362f761b34dfbd779f9af0e58aa6adbde41b | |
| parent | 0755722ecc0777a618a3b2eec5e1d94916bb2b8f (diff) | |
Open Windows console earlier in startup.
| -rw-r--r-- | src/tools/dcpomatic.cc | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index bd5cbaa7a..0ed65da8d 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -306,25 +306,6 @@ public: , _right_panel(new wxPanel(_splitter, wxID_ANY)) , _film_viewer(_right_panel) { -#if defined(DCPOMATIC_WINDOWS) - if (Config::instance()->win32_console()) { - AllocConsole(); - - HANDLE handle_out = GetStdHandle(STD_OUTPUT_HANDLE); - int hCrt = _open_osfhandle((intptr_t) handle_out, _O_TEXT); - FILE* hf_out = _fdopen(hCrt, "w"); - setvbuf(hf_out, NULL, _IONBF, 1); - *stdout = *hf_out; - - HANDLE handle_in = GetStdHandle(STD_INPUT_HANDLE); - hCrt = _open_osfhandle((intptr_t) handle_in, _O_TEXT); - FILE* hf_in = _fdopen(hCrt, "r"); - setvbuf(hf_in, NULL, _IONBF, 128); - *stdin = *hf_in; - - cout << "DCP-o-matic is starting." << "\n"; - } -#endif auto bar = new wxMenuBar; setup_menu (bar); @@ -1610,6 +1591,26 @@ private: bool OnInit () override { try { + +#if defined(DCPOMATIC_WINDOWS) + if (Config::instance()->win32_console()) { + AllocConsole(); + + HANDLE handle_out = GetStdHandle(STD_OUTPUT_HANDLE); + int hCrt = _open_osfhandle((intptr_t) handle_out, _O_TEXT); + FILE* hf_out = _fdopen(hCrt, "w"); + setvbuf(hf_out, NULL, _IONBF, 1); + *stdout = *hf_out; + + HANDLE handle_in = GetStdHandle(STD_INPUT_HANDLE); + hCrt = _open_osfhandle((intptr_t) handle_in, _O_TEXT); + FILE* hf_in = _fdopen(hCrt, "r"); + setvbuf(hf_in, NULL, _IONBF, 128); + *stdin = *hf_in; + + cout << "DCP-o-matic is starting." << "\n"; + } +#endif wxInitAllImageHandlers (); Config::FailedToLoad.connect(boost::bind(&App::config_failed_to_load, this, _1)); |
