]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/app.cpp
make sure we are comparing the stripped strings
[wxWidgets.git] / src / msw / app.cpp
index 6143dbb8520365c7628e55da3bc9ce480eb463e5..7d430057a94f7e5c2384d95b4f3b50a454bd5e89 100644 (file)
 
 #include "wx/msw/wrapcctl.h"
 
+// For MB_TASKMODAL
+#ifdef __WXWINCE__
+#include "wx/msw/wince/missing.h"
+#endif
+
 #if (!defined(__MINGW32__) || wxCHECK_W32API_VERSION( 2, 0 )) && \
     !defined(__CYGWIN__) && !defined(__DIGITALMARS__) && !defined(__WXWINCE__) && \
     (!defined(_MSC_VER) || (_MSC_VER > 1100))
@@ -535,6 +540,10 @@ wxApp::~wxApp()
     delete [] argv;
 }
 
+// ----------------------------------------------------------------------------
+// wxApp idle handling
+// ----------------------------------------------------------------------------
+
 void wxApp::OnIdle(wxIdleEvent& event)
 {
     wxAppBase::OnIdle(event);
@@ -565,6 +574,10 @@ void wxApp::WakeUpIdle()
     }
 }
 
+// ----------------------------------------------------------------------------
+// other wxApp event hanlders
+// ----------------------------------------------------------------------------
+
 void wxApp::OnEndSession(wxCloseEvent& WXUNUSED(event))
 {
     if (GetTopWindow())
@@ -582,6 +595,10 @@ void wxApp::OnQueryEndSession(wxCloseEvent& event)
     }
 }
 
+// ----------------------------------------------------------------------------
+// miscellaneous
+// ----------------------------------------------------------------------------
+
 /* static */
 int wxApp::GetComCtl32Version()
 {
@@ -720,3 +737,43 @@ bool wxApp::Yield(bool onlyIfNeeded)
     return TRUE;
 }
 
+#if wxUSE_EXCEPTIONS
+
+// ----------------------------------------------------------------------------
+// exception handling
+// ----------------------------------------------------------------------------
+
+bool wxApp::OnExceptionInMainLoop()
+{
+    // ask the user about what to do: use the Win32 API function here as it
+    // could be dangerous to use any wxWindows code in this state
+    switch (
+            ::MessageBox
+              (
+                NULL,
+                _T("An unhandled exception occurred. Press \"Abort\" to \
+terminate the program,\r\n\
+\"Retry\" to exit the program normally and \"Ignore\" to try to continue."),
+                _T("Unhandled exception"),
+                MB_ABORTRETRYIGNORE |
+                MB_ICONERROR| 
+                MB_TASKMODAL
+              )
+           )
+    {
+        case IDABORT:
+            throw;
+
+        default:
+            wxFAIL_MSG( _T("unexpected MessageBox() return code") );
+            // fall through
+
+        case IDRETRY:
+            return false;
+
+        case IDIGNORE:
+            return true;
+    }
+}
+
+#endif // wxUSE_EXCEPTIONS