]> git.saurik.com Git - wxWidgets.git/commitdiff
Applied patch [ 619705 ] Fixes wxApp::GetComCtl32Version
authorJulian Smart <julian@anthemion.co.uk>
Sun, 1 Jun 2003 13:50:55 +0000 (13:50 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Sun, 1 Jun 2003 13:50:55 +0000 (13:50 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20814 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/app.cpp
src/msw/notebook.cpp

index 98e28146495386e069b51ded1146f3e53952f348..d5a953bbcbbf20e9a53d3ff0592599084171af98 100644 (file)
@@ -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;
index 7ee5b2337a2f9757976baa4371a3290012a71a17..fda283e4965679ccdd50267b053df6463364d519 100644 (file)
@@ -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
 // ----------------------------------------------------------------------------