From 858cab30bea10ff181fe358fe6b2b56961da5563 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 15 Jun 2005 22:04:53 +0000 Subject: [PATCH] WinCE compilation fixes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34662 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/msgout.cpp | 19 ++++++++++++++++--- src/msw/menu.cpp | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/common/msgout.cpp b/src/common/msgout.cpp index 87d9e708d4..3e9471de8d 100755 --- a/src/common/msgout.cpp +++ b/src/common/msgout.cpp @@ -92,6 +92,21 @@ wxMessageOutput* wxMessageOutput::Set(wxMessageOutput* msgout) // wxMessageOutputBest // ---------------------------------------------------------------------------- +#ifdef __WINDOWS__ + +// check if we're running in a console under Windows +static inline bool IsInConsole() +{ +#ifdef __WXWINCE__ + return false; +#else // !__WXWINCE__ + HANDLE hStdErr = ::GetStdHandle(STD_ERROR_HANDLE); + return hStdErr && hStdErr != INVALID_HANDLE_VALUE; +#endif // __WXWINCE__/!__WXWINCE__ +} + +#endif // __WINDOWS__ + void wxMessageOutputBest::Printf(const wxChar* format, ...) { va_list args; @@ -102,9 +117,7 @@ void wxMessageOutputBest::Printf(const wxChar* format, ...) 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 ) + if ( !IsInConsole() ) { ::MessageBox(NULL, out, _T("wxWidgets"), MB_ICONINFORMATION | MB_OK); } diff --git a/src/msw/menu.cpp b/src/msw/menu.cpp index 4880a3807b..ee300d548c 100644 --- a/src/msw/menu.cpp +++ b/src/msw/menu.cpp @@ -386,7 +386,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) if ( pos == (size_t)-1 ) { // append at the end - pos = ::GetMenuItemCount(GetHmenu()); + pos = GetMenuItemCount(); } BOOL ok = false;