X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e12a951e754d0e6a67a211a1d8fb788e0a166094..b9efe021b554fa3967d1442cf758435c5cd5ae8f:/src/common/msgout.cpp?ds=inline diff --git a/src/common/msgout.cpp b/src/common/msgout.cpp index f5642aa6c3..84bb0547e4 100755 --- a/src/common/msgout.cpp +++ b/src/common/msgout.cpp @@ -102,10 +102,17 @@ void wxMessageOutputBest::Printf(const wxChar* format, ...) va_end(args); #ifdef __WINDOWS__ - ::MessageBox(NULL, out, _T("wxWidgets"), MB_ICONINFORMATION | MB_OK); -#else // !__WINDOWS__ - fprintf(stderr, "%s", (const char*) out.mb_str()); + // check if we're running in a console + HANDLE hStdErr = ::GetStdHandle(STD_ERROR_HANDLE); + if ( !hStdErr || hStdErr == INVALID_HANDLE_VALUE ) + { + ::MessageBox(NULL, out, _T("wxWidgets"), MB_ICONINFORMATION | MB_OK); + } + else #endif // __WINDOWS__/!__WINDOWS__ + { + fprintf(stderr, "%s", (const char*) out.mb_str()); + } } // ----------------------------------------------------------------------------