Code for single instance and bring-to-top under CE.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26869 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2004-04-19 21:47:12 +00:00
parent b33f7651ae
commit 46fa338b6f
3 changed files with 34 additions and 2 deletions

View File

@@ -99,8 +99,13 @@ extern void wxSetKeyboardHook(bool doIt);
// NB: all "NoRedraw" classes must have the same names as the "normal" classes // NB: all "NoRedraw" classes must have the same names as the "normal" classes
// with NR suffix - wxWindow::MSWCreate() supposes this // with NR suffix - wxWindow::MSWCreate() supposes this
#ifdef __WXWINCE__
wxChar *wxCanvasClassName;
wxChar *wxCanvasClassNameNR;
#else
const wxChar *wxCanvasClassName = wxT("wxWindowClass"); const wxChar *wxCanvasClassName = wxT("wxWindowClass");
const wxChar *wxCanvasClassNameNR = wxT("wxWindowClassNR"); const wxChar *wxCanvasClassNameNR = wxT("wxWindowClassNR");
#endif
const wxChar *wxMDIFrameClassName = wxT("wxMDIFrameClass"); const wxChar *wxMDIFrameClassName = wxT("wxMDIFrameClass");
const wxChar *wxMDIFrameClassNameNoRedraw = wxT("wxMDIFrameClassNR"); const wxChar *wxMDIFrameClassNameNoRedraw = wxT("wxMDIFrameClassNR");
const wxChar *wxMDIChildFrameClassName = wxT("wxMDIChildFrameClass"); 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 // ensure that base cleanup is done if we return too early
wxCallBaseCleanup callBaseCleanup(this); 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 // 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 // program under Win9x w/o MSLU emulation layer - if so, abort right now
// as it has no chance to work // as it has no chance to work
@@ -514,6 +533,11 @@ void wxApp::CleanUp()
delete wxWinHandleHash; delete wxWinHandleHash;
wxWinHandleHash = NULL; wxWinHandleHash = NULL;
#ifdef __WXWINCE__
free( wxCanvasClassName );
free( wxCanvasClassNameNR );
#endif
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -88,7 +88,11 @@ wxDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
wxWindowList wxModelessWindows; wxWindowList wxModelessWindows;
// the name of the default wxWindows class // the name of the default wxWindows class
#ifdef __WXWINCE__
extern wxChar *wxCanvasClassName;
#else
extern const wxChar *wxCanvasClassName; extern const wxChar *wxCanvasClassName;
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxTLWHiddenParentModule: used to manage the hidden parent window (we need a // wxTLWHiddenParentModule: used to manage the hidden parent window (we need a

View File

@@ -128,7 +128,11 @@
wxMenu *wxCurrentPopupMenu = NULL; wxMenu *wxCurrentPopupMenu = NULL;
#endif // wxUSE_MENUS_NATIVE #endif // wxUSE_MENUS_NATIVE
#ifdef __WXWINCE__
extern wxChar *wxCanvasClassName;
#else
extern const wxChar *wxCanvasClassName; extern const wxChar *wxCanvasClassName;
#endif
// true if we had already created the std colour map, used by // true if we had already created the std colour map, used by
// wxGetStdColourMap() and wxWindow::OnSysColourChanged() (FIXME-MT) // wxGetStdColourMap() and wxWindow::OnSysColourChanged() (FIXME-MT)
@@ -1022,8 +1026,8 @@ bool wxCheckWindowWndProc(WXHWND hWnd, WXFARPROC wndProc)
// On WinCE (at least), the wndproc comparison doesn't work, // On WinCE (at least), the wndproc comparison doesn't work,
// so have to use something like this. // so have to use something like this.
#ifdef __WXWINCE__ #ifdef __WXWINCE__
extern const wxChar *wxCanvasClassName; extern wxChar *wxCanvasClassName;
extern const wxChar *wxCanvasClassNameNR; extern wxChar *wxCanvasClassNameNR;
extern const wxChar *wxMDIFrameClassName; extern const wxChar *wxMDIFrameClassName;
extern const wxChar *wxMDIFrameClassNameNoRedraw; extern const wxChar *wxMDIFrameClassNameNoRedraw;
extern const wxChar *wxMDIChildFrameClassName; extern const wxChar *wxMDIChildFrameClassName;