implemented wxApp::OnExceptionInMainLoop()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26506 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2004-03-30 20:50:59 +00:00
parent b76f0023ae
commit 6046e57acc
2 changed files with 61 additions and 7 deletions

View File

@@ -50,20 +50,18 @@ public:
void OnEndSession(wxCloseEvent& event); void OnEndSession(wxCloseEvent& event);
void OnQueryEndSession(wxCloseEvent& event); void OnQueryEndSession(wxCloseEvent& event);
#if wxUSE_EXCEPTIONS
virtual bool OnExceptionInMainLoop();
#endif // wxUSE_EXCEPTIONS
protected: protected:
int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
/* Windows-specific wxApp definitions */
public: public:
// Implementation // Implementation
static bool RegisterWindowClasses(); static bool RegisterWindowClasses();
static bool UnregisterWindowClasses(); static bool UnregisterWindowClasses();
// idle processing
// ---------------
#if wxUSE_RICHEDIT #if wxUSE_RICHEDIT
// initialize the richedit DLL of (at least) given version, return TRUE if // initialize the richedit DLL of (at least) given version, return TRUE if
// ok (Win95 has version 1, Win98/NT4 has 1 and 2, W2K has 3) // ok (Win95 has version 1, Win98/NT4 has 1 and 2, W2K has 3)
@@ -74,7 +72,6 @@ public:
// wasn't found at all // wasn't found at all
static int GetComCtl32Version(); static int GetComCtl32Version();
public:
// the SW_XXX value to be used for the frames opened by the application // the SW_XXX value to be used for the frames opened by the application
// (currently seems unused which is a bug -- TODO) // (currently seems unused which is a bug -- TODO)
static int m_nCmdShow; static int m_nCmdShow;

View File

@@ -76,6 +76,11 @@
#include "wx/msw/wrapcctl.h" #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 )) && \ #if (!defined(__MINGW32__) || wxCHECK_W32API_VERSION( 2, 0 )) && \
!defined(__CYGWIN__) && !defined(__DIGITALMARS__) && !defined(__WXWINCE__) && \ !defined(__CYGWIN__) && !defined(__DIGITALMARS__) && !defined(__WXWINCE__) && \
(!defined(_MSC_VER) || (_MSC_VER > 1100)) (!defined(_MSC_VER) || (_MSC_VER > 1100))
@@ -535,6 +540,10 @@ wxApp::~wxApp()
delete [] argv; delete [] argv;
} }
// ----------------------------------------------------------------------------
// wxApp idle handling
// ----------------------------------------------------------------------------
void wxApp::OnIdle(wxIdleEvent& event) void wxApp::OnIdle(wxIdleEvent& event)
{ {
wxAppBase::OnIdle(event); wxAppBase::OnIdle(event);
@@ -565,6 +574,10 @@ void wxApp::WakeUpIdle()
} }
} }
// ----------------------------------------------------------------------------
// other wxApp event hanlders
// ----------------------------------------------------------------------------
void wxApp::OnEndSession(wxCloseEvent& WXUNUSED(event)) void wxApp::OnEndSession(wxCloseEvent& WXUNUSED(event))
{ {
if (GetTopWindow()) if (GetTopWindow())
@@ -582,6 +595,10 @@ void wxApp::OnQueryEndSession(wxCloseEvent& event)
} }
} }
// ----------------------------------------------------------------------------
// miscellaneous
// ----------------------------------------------------------------------------
/* static */ /* static */
int wxApp::GetComCtl32Version() int wxApp::GetComCtl32Version()
{ {
@@ -720,3 +737,43 @@ bool wxApp::Yield(bool onlyIfNeeded)
return TRUE; 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