X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7adf0b4de22c8841465564842c4a91a79bef8071..b9efe021b554fa3967d1442cf758435c5cd5ae8f:/src/msw/main.cpp diff --git a/src/msw/main.cpp b/src/msw/main.cpp index 93b4eb4e4d..577873e340 100644 --- a/src/msw/main.cpp +++ b/src/msw/main.cpp @@ -70,7 +70,7 @@ extern int wxEntryReal(int& argc, wxChar **argv); #if wxUSE_BASE -#if defined(__VISUALC__) && !defined(__WXWINCE__) +#if wxUSE_ON_FATAL_EXCEPTION && defined(__VISUALC__) && !defined(__WXWINCE__) // VC++ (at least from 4.0 up to version 7.1) is incredibly broken in that // a "catch ( ... )" will *always* catch SEH exceptions in it even though // it should have never been the case... to prevent such catches from @@ -93,7 +93,7 @@ extern int wxEntryReal(int& argc, wxChar **argv); #endif // __VISUALC__/!__VISUALC__ // ---------------------------------------------------------------------------- -// wrapper wxEntry catching all Win32 exceptions occuring in a wx program +// wrapper wxEntry catching all Win32 exceptions occurring in a wx program // ---------------------------------------------------------------------------- // wrap real wxEntry in a try-except block to be able to call @@ -219,8 +219,11 @@ int wxEntry(int& argc, wxChar **argv) { wxFatalExit(); - // this code is unreachable but put it here to suppress warnings +#if !defined(_MSC_VER) || defined(__WXDEBUG__) || (defined(_MSC_VER) && _MSC_VER <= 1200) + // this code is unreachable but put it here to suppress warnings in some compilers + // and disable for others to supress warnings too return -1; +#endif // !__VISUALC__ in release build } } @@ -259,6 +262,28 @@ WXDLLEXPORT int wxEntry(HINSTANCE hInstance, wxCmdLineArgType WXUNUSED(pCmdLine), int nCmdShow) { + // the first thing to do is to check if we're trying to run an Unicode + // program under Win9x w/o MSLU emulation layer - if so, abort right now + // as it has no chance to work and has all chances to crash +#if wxUSE_UNICODE && !wxUSE_UNICODE_MSLU && !defined(__WXWINCE__) + if ( wxGetOsVersion() != wxWINDOWS_NT ) + { + // note that we can use MessageBoxW() as it's implemented even under + // Win9x - OTOH, we can't use wxGetTranslation() because the file APIs + // used by wxLocale are not + ::MessageBox + ( + NULL, + _T("This program uses Unicode and requires Windows NT/2000/XP.\nProgram aborted."), + _T("wxWidgets Fatal Error"), + MB_ICONERROR | MB_OK + ); + + return -1; + } +#endif // wxUSE_UNICODE && !wxUSE_UNICODE_MSLU + + // remember the parameters Windows gave us wxSetInstance(hInstance); wxApp::m_nCmdShow = nCmdShow;