]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/msgout.cpp
Hopefully fixed library names generated by wx-config for OS/2's PM port.
[wxWidgets.git] / src / common / msgout.cpp
index f5642aa6c39e9472f237472244d7416dfa95f695..84bb0547e4462b0188af678013239d189820bc10 100755 (executable)
@@ -102,10 +102,17 @@ void wxMessageOutputBest::Printf(const wxChar* format, ...)
     va_end(args);
 
 #ifdef __WINDOWS__
     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__
 #endif // __WINDOWS__/!__WINDOWS__
+    {
+        fprintf(stderr, "%s", (const char*) out.mb_str());
+    }
 }
 
 // ----------------------------------------------------------------------------
 }
 
 // ----------------------------------------------------------------------------