diff --git a/include/wx/msw/mfc.h b/include/wx/msw/mfc.h index 49974bb9ea..894918f194 100644 --- a/include/wx/msw/mfc.h +++ b/include/wx/msw/mfc.h @@ -42,12 +42,17 @@ public: // MFC application class forwarding everything to wxApp // ---------------------------------------------------------------------------- -class wxMFCWinApp : public CWinApp +// The template parameter here is an existing class deriving from CWinApp or, +// if there is no such class, just CWinApp itself. +template +class wxMFCApp : public T { public: + typedef T BaseApp; + BOOL InitInstance() wxOVERRIDE { - if ( !CWinApp::InitInstance() ) + if ( !BaseApp::InitInstance() ) return FALSE; if ( !wxEntryStart(m_hInstance) ) @@ -71,7 +76,7 @@ public: wxEntryCleanup(); - return CWinApp::ExitInstance(); + return BaseApp::ExitInstance(); } // Override this to provide wxWidgets message loop compatibility @@ -82,12 +87,12 @@ public: if ( evtLoop && evtLoop->PreProcessMessage(msg) ) return TRUE; - return CWinApp::PreTranslateMessage(msg); + return BaseApp::PreTranslateMessage(msg); } BOOL OnIdle(LONG lCount) wxOVERRIDE { - BOOL moreIdle = CWinApp::OnIdle(lCount); + BOOL moreIdle = BaseApp::OnIdle(lCount); if ( wxTheApp && wxTheApp->ProcessIdle() ) moreIdle = TRUE; @@ -119,6 +124,8 @@ protected: } }; +typedef wxMFCApp wxMFCWinApp; + // ---------------------------------------------------------------------------- // wxWidgets application class to be used in MFC applications // ----------------------------------------------------------------------------