]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/app.cpp
Eliminated some code.
[wxWidgets.git] / src / msw / app.cpp
index e91969f481261650ed19e4a1c22e42740b548793..d5a953bbcbbf20e9a53d3ff0592599084171af98 100644 (file)
@@ -71,7 +71,7 @@
 
 // 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
@@ -84,7 +84,7 @@
 #include <string.h>
 #include <ctype.h>
 
-#if defined(__WIN95__) && !((defined(__GNUWIN32_OLD__) || defined(__TWIN32__) || defined(__WXMICROWIN__)) && !defined(__CYGWIN10__))
+#if defined(__WIN95__) && !((defined(__GNUWIN32_OLD__) || defined(__WXMICROWIN__)) && !defined(__CYGWIN10__))
     #include <commctrl.h>
 #endif
 
@@ -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;
@@ -1381,6 +1404,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