X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6046e57acc865a87cf9f94d27d3c0fb4b0aa18ac..49e3e2c25f93dd8114b36155de1756139b7f18b9:/src/msw/app.cpp diff --git a/src/msw/app.cpp b/src/msw/app.cpp index 7d430057a9..688ca701e2 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -99,8 +99,13 @@ extern void wxSetKeyboardHook(bool doIt); // NB: all "NoRedraw" classes must have the same names as the "normal" classes // with NR suffix - wxWindow::MSWCreate() supposes this +#ifdef __WXWINCE__ + wxChar *wxCanvasClassName; + wxChar *wxCanvasClassNameNR; +#else const wxChar *wxCanvasClassName = wxT("wxWindowClass"); const wxChar *wxCanvasClassNameNR = wxT("wxWindowClassNR"); +#endif const wxChar *wxMDIFrameClassName = wxT("wxMDIFrameClass"); const wxChar *wxMDIFrameClassNameNoRedraw = wxT("wxMDIFrameClassNR"); const wxChar *wxMDIChildFrameClassName = wxT("wxMDIChildFrameClass"); @@ -254,6 +259,20 @@ bool wxApp::Initialize(int& argc, wxChar **argv) // ensure that base cleanup is done if we return too early wxCallBaseCleanup callBaseCleanup(this); +#ifdef __WXWINCE__ + wxString tmp = GetAppName(); + tmp += wxT("ClassName"); + wxCanvasClassName = wxStrdup( tmp.c_str() ); + tmp += wxT("NR"); + wxCanvasClassNameNR = wxStrdup( tmp.c_str() ); + HWND hWnd = FindWindow( wxCanvasClassNameNR, NULL ); + if (hWnd) + { + SetForegroundWindow( (HWND)(((DWORD)hWnd)|0x01) ); + return false; + } +#endif + // 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 @@ -267,7 +286,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv) ( NULL, _T("This program uses Unicode and requires Windows NT/2000/XP/CE.\nProgram aborted."), - _T("wxWindows Fatal Error"), + _T("wxWidgets Fatal Error"), MB_ICONERROR | MB_OK ); @@ -303,20 +322,19 @@ bool wxApp::Initialize(int& argc, wxChar **argv) RegisterWindowClasses(); -#if defined(__WXMICROWIN__) && !defined(__WXWINCE__) +#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) // Create the brush for disabling bitmap buttons - LOGBRUSH lb; lb.lbStyle = BS_PATTERN; lb.lbColor = 0; lb.lbHatch = (int)LoadBitmap( wxhInstance, wxT("wxDISABLE_BUTTON_BITMAP") ); if ( lb.lbHatch ) { - wxDisableButtonBrush = ::CreateBrushIndirect( & lb ); + wxDisableButtonBrush = ::CreateBrushIndirect( &lb ); ::DeleteObject( (HGDIOBJ)lb.lbHatch ); } - //else: wxWindows resources are probably not linked in -#endif + //else: wxWidgets resources are probably not linked in +#endif // !__WXMICROWIN__ && !__WXWINCE__ #if wxUSE_PENWINDOWS wxRegisterPenWin(); @@ -514,6 +532,11 @@ void wxApp::CleanUp() delete wxWinHandleHash; wxWinHandleHash = NULL; + +#ifdef __WXWINCE__ + free( wxCanvasClassName ); + free( wxCanvasClassNameNR ); +#endif } // ---------------------------------------------------------------------------- @@ -746,7 +769,7 @@ bool wxApp::Yield(bool onlyIfNeeded) 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 + // could be dangerous to use any wxWidgets code in this state switch ( ::MessageBox (