From: Julian Smart Date: Sun, 1 Jun 2003 13:50:55 +0000 (+0000) Subject: Applied patch [ 619705 ] Fixes wxApp::GetComCtl32Version X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/ef094fa075bc56bcbc33b12159c395ea28afda3b Applied patch [ 619705 ] Fixes wxApp::GetComCtl32Version git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20814 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/app.cpp b/src/msw/app.cpp index 98e2814649..d5a953bbcb 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -1185,6 +1185,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() { @@ -1204,17 +1215,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); @@ -1231,7 +1250,6 @@ int wxApp::GetComCtl32Version() dvi.dwMinorVersion; } } - #endif // DllGetVersion() unavailable either during compile or // run-time, try to guess the version otherwise if ( !s_verComCtl32 ) @@ -1270,6 +1288,11 @@ int wxApp::GetComCtl32Version() } } } + + if(bFreeComCtl32) + { + ::FreeLibrary(hModuleComCtl32) ; + } } return s_verComCtl32; diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index 7ee5b2337a..fda283e496 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -468,25 +468,6 @@ bool wxNotebook::InsertPage(int nPage, // finally do insert it if ( TabCtrl_InsertItem(m_hwnd, nPage, &tcItem) == -1 ) { -// Hit test -int wxNotebook::HitTest(const wxPoint& pt, long& flags) -{ - TC_HITTESTINFO hitTestInfo; - hitTestInfo.pt.x = pt.x; - hitTestInfo.pt.y = pt.y; - int item = TabCtrl_HitTest( (HWND) GetHWND(), & hitTestInfo ) ; - flags = 0; - - if ((hitTestInfo.flags & TCHT_NOWHERE) == TCHT_NOWHERE) - flags |= wxNB_HITTEST_NOWHERE; - if ((hitTestInfo.flags & TCHT_ONITEMICON) == TCHT_ONITEMICON) - flags |= wxNB_HITTEST_ONICON; - if ((hitTestInfo.flags & TCHT_ONITEMLABEL) == TCHT_ONITEMLABEL) - flags |= wxNB_HITTEST_ONLABEL; - - return item; -} - wxLogError(wxT("Can't create the notebook page '%s'."), strText.c_str()); return FALSE; @@ -538,6 +519,25 @@ int wxNotebook::HitTest(const wxPoint& pt, long& flags) return TRUE; } +// Hit test +int wxNotebook::HitTest(const wxPoint& pt, long& flags) +{ + TC_HITTESTINFO hitTestInfo; + hitTestInfo.pt.x = pt.x; + hitTestInfo.pt.y = pt.y; + int item = TabCtrl_HitTest( (HWND) GetHWND(), & hitTestInfo ) ; + flags = 0; + + if ((hitTestInfo.flags & TCHT_NOWHERE) == TCHT_NOWHERE) + flags |= wxNB_HITTEST_NOWHERE; + if ((hitTestInfo.flags & TCHT_ONITEMICON) == TCHT_ONITEMICON) + flags |= wxNB_HITTEST_ONICON; + if ((hitTestInfo.flags & TCHT_ONITEMLABEL) == TCHT_ONITEMLABEL) + flags |= wxNB_HITTEST_ONLABEL; + + return item; +} + // ---------------------------------------------------------------------------- // wxNotebook callbacks // ----------------------------------------------------------------------------