X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d6e6a35c801690a6456a85331c7f56fe04999c6f..b9efe021b554fa3967d1442cf758435c5cd5ae8f:/src/common/msgout.cpp?ds=inline diff --git a/src/common/msgout.cpp b/src/common/msgout.cpp index e0068a01fd..84bb0547e4 100755 --- a/src/common/msgout.cpp +++ b/src/common/msgout.cpp @@ -19,7 +19,7 @@ #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) && !defined(__EMX__) // Some older compilers (such as EMX) cannot handle -// #pragma interface/implementation correctly, iff +// #pragma interface/implementation correctly, iff // #pragma implementation is used in _two_ translation // units (as created by e.g. event.cpp compiled for // libwx_base and event.cpp compiled for libwx_gui_core). @@ -52,7 +52,7 @@ #include #include -#ifdef __WXMSW__ +#if defined(__WXMSW__) #include "wx/msw/private.h" #endif #ifdef __WXMAC__ @@ -88,6 +88,33 @@ wxMessageOutput* wxMessageOutput::Set(wxMessageOutput* msgout) return old; } +// ---------------------------------------------------------------------------- +// wxMessageOutputBest +// ---------------------------------------------------------------------------- + +void wxMessageOutputBest::Printf(const wxChar* format, ...) +{ + va_list args; + va_start(args, format); + wxString out; + + out.PrintfV(format, args); + va_end(args); + +#ifdef __WINDOWS__ + // 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()); + } +} + // ---------------------------------------------------------------------------- // wxMessageOutputStderr // ----------------------------------------------------------------------------