X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9b4e3f352b36dee39d7e451a6c9db90862f5563e..e00a5d3ca15eec8db3e231d79d82ff6965e3466b:/src/msw/app.cpp diff --git a/src/msw/app.cpp b/src/msw/app.cpp index 072874afb7..0ece73173d 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -65,17 +65,13 @@ WX_DEFINE_OBJARRAY(wxMsgArray); #endif // wxUSE_THREADS -#if wxUSE_WX_RESOURCES - #include "wx/resource.h" -#endif - #if wxUSE_TOOLTIPS #include "wx/tooltip.h" #endif // wxUSE_TOOLTIPS // OLE is used for drag-and-drop, clipboard, OLE Automation..., but some // compilers don't support it (missing headers, libs, ...) -#if defined(__GNUWIN32_OLD__) || defined(__SC__) || defined(__SALFORDC__) +#if defined(__GNUWIN32_OLD__) || defined(__SYMANTEC__) || defined(__SALFORDC__) #undef wxUSE_OLE #define wxUSE_OLE 0 @@ -88,7 +84,7 @@ #include #include -#if defined(__WIN95__) && !((defined(__GNUWIN32_OLD__) || defined(__TWIN32__) || defined(__WXMICROWIN__)) && !defined(__CYGWIN10__)) +#if defined(__WIN95__) && !((defined(__GNUWIN32_OLD__) || defined(__WXMICROWIN__)) && !defined(__CYGWIN10__)) #include #endif @@ -191,7 +187,7 @@ END_EVENT_TABLE() bool wxApp::Initialize() { // 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 #if wxUSE_UNICODE && !wxUSE_UNICODE_MSLU if ( wxGetOsVersion() != wxWINDOWS_NT ) @@ -225,10 +221,6 @@ bool wxApp::Initialize() wxInitializeStockLists(); wxInitializeStockObjects(); -#if wxUSE_WX_RESOURCES - wxInitializeResourceSystem(); -#endif - wxBitmap::InitStandardHandlers(); #if defined(__WIN95__) && !defined(__WXMICROWIN__) @@ -511,12 +503,6 @@ void wxApp::CleanUp() wxModule::CleanUpModules(); -#if wxUSE_WX_RESOURCES - wxCleanUpResourceSystem(); - - // wxDefaultResourceTable->ClearTable(); -#endif - wxDeleteStockObjects(); // Destroy all GDI lists, etc. @@ -574,13 +560,14 @@ void wxApp::CleanUp() #endif delete wxWinHandleHash; + wxWinHandleHash = NULL; // Set to null in case anything later tries to ref it. - // GL: I'm annoyed ... I don't know where to put this and I don't want to - // create a module for that as it's part of the core. delete wxPendingEvents; + wxPendingEvents = NULL; // Set to null because wxAppBase::wxEvtHandler is destroyed later. #if wxUSE_THREADS delete wxPendingEventsLocker; + wxPendingEventsLocker = NULL; // Set to null because wxAppBase::wxEvtHandler is destroyed later. // If we don't do the following, we get an apparent memory leak #if wxUSE_VALIDATORS ((wxEvtHandler&) wxDefaultValidator).ClearEventLocker(); @@ -1194,6 +1181,17 @@ void wxApp::OnQueryEndSession(wxCloseEvent& event) } } +typedef struct _WXADllVersionInfo +{ + DWORD cbSize; + DWORD dwMajorVersion; // Major version + DWORD dwMinorVersion; // Minor version + DWORD dwBuildNumber; // Build number + DWORD dwPlatformID; // DLLVER_PLATFORM_* +} WXADLLVERSIONINFO; + +typedef HRESULT (CALLBACK* WXADLLGETVERSIONPROC)(WXADLLVERSIONINFO *); + /* static */ int wxApp::GetComCtl32Version() { @@ -1213,17 +1211,25 @@ int wxApp::GetComCtl32Version() // do we have it? HMODULE hModuleComCtl32 = ::GetModuleHandle(wxT("COMCTL32")); + BOOL bFreeComCtl32 = FALSE ; + if(!hModuleComCtl32) + { + hModuleComCtl32 = ::LoadLibrary(wxT("COMCTL32.DLL")) ; + if(hModuleComCtl32) + { + bFreeComCtl32 = TRUE ; + } + } // if so, then we can check for the version if ( hModuleComCtl32 ) { // try to use DllGetVersion() if available in _headers_ - #ifdef DLLVER_PLATFORM_WINDOWS // defined in shlwapi.h - DLLGETVERSIONPROC pfnDllGetVersion = (DLLGETVERSIONPROC) + WXADLLGETVERSIONPROC pfnDllGetVersion = (WXADLLGETVERSIONPROC) ::GetProcAddress(hModuleComCtl32, "DllGetVersion"); if ( pfnDllGetVersion ) { - DLLVERSIONINFO dvi; + WXADLLVERSIONINFO dvi; dvi.cbSize = sizeof(dvi); HRESULT hr = (*pfnDllGetVersion)(&dvi); @@ -1240,7 +1246,6 @@ int wxApp::GetComCtl32Version() dvi.dwMinorVersion; } } - #endif // DllGetVersion() unavailable either during compile or // run-time, try to guess the version otherwise if ( !s_verComCtl32 ) @@ -1279,6 +1284,11 @@ int wxApp::GetComCtl32Version() } } } + + if(bFreeComCtl32) + { + ::FreeLibrary(hModuleComCtl32) ; + } } return s_verComCtl32; @@ -1390,6 +1400,6 @@ void wxWakeUpIdle() // For some reason, with MSVC++ 1.5, WinMain isn't linked in properly // if in a separate file. So include it here to ensure it's linked. -#if (defined(__VISUALC__) && !defined(__WIN32__)) || (defined(__GNUWIN32__) && !defined(__WINE__) && !defined(__TWIN32__) && !defined(WXMAKINGDLL)) +#if (defined(__VISUALC__) && !defined(__WIN32__)) || (defined(__GNUWIN32__) && !defined(__WINE__) && !defined(WXMAKINGDLL)) #include "main.cpp" #endif