use stderr in wxMessageOutputBest::Printf() even under Windows if it's available (patch 1216159)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34564 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2005-06-07 12:06:44 +00:00
parent a23bbe9364
commit 9d03b4eee2

View File

@@ -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());
}
}
// ----------------------------------------------------------------------------