]> 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 f588f326df9b5f251248ce226147026ea5c6030c..84bb0547e4462b0188af678013239d189820bc10 100755 (executable)
@@ -52,7 +52,7 @@
 #include <stdarg.h>
 #include <stdio.h>
 
-#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
 // ----------------------------------------------------------------------------