1 // ResizableVersion.cpp: implementation of the CResizableVersion class.
3 /////////////////////////////////////////////////////////////////////////////
5 // This file is part of ResizableLib
6 // http://sourceforge.net/projects/resizablelib
8 // Copyright (C) 2000-2004 by Paolo Messina
9 // http://www.geocities.com/ppescher - mailto:ppescher@hotmail.com
11 // The contents of this file are subject to the Artistic License (the "License").
12 // You may not use this file except in compliance with the License.
13 // You may obtain a copy of the License at:
14 // http://www.opensource.org/licenses/artistic-license.html
16 // If you find this code useful, credits would be nice!
18 /////////////////////////////////////////////////////////////////////////////
21 #include "ResizableVersion.h"
23 //////////////////////////////////////////////////////////////////////
24 // Static initializer object (with macros to hide in ClassView)
26 // static intializer must be called before user code
27 #pragma warning(disable:4073)
31 #define BEGIN_HIDDEN {
39 struct _VersionInitializer
48 // The one and only version-check object
49 static _VersionInitializer g_version
;
51 //////////////////////////////////////////////////////////////////////
52 // Private implementation
54 // DLL Version support
57 static DLLVERSIONINFO g_dviCommCtrls
;
59 static void CheckCommCtrlsVersion()
61 // Check Common Controls version
62 SecureZeroMemory(&g_dviCommCtrls
, sizeof(DLLVERSIONINFO
));
63 HMODULE hMod
= AtlLoadSystemLibraryUsingFullPath(_T("comctl32.dll"));
66 // Get the version function
67 DLLGETVERSIONPROC pfnDllGetVersion
;
68 pfnDllGetVersion
= (DLLGETVERSIONPROC
)GetProcAddress(hMod
, "DllGetVersion");
70 if (pfnDllGetVersion
!= NULL
)
72 // Obtain version information
73 g_dviCommCtrls
.cbSize
= sizeof(DLLVERSIONINFO
);
74 if (SUCCEEDED(pfnDllGetVersion(&g_dviCommCtrls
)))
84 // Set values for the worst case
85 g_dviCommCtrls
.dwMajorVersion
= 4;
86 g_dviCommCtrls
.dwMinorVersion
= 0;
87 g_dviCommCtrls
.dwBuildNumber
= 0;
88 g_dviCommCtrls
.dwPlatformID
= DLLVER_PLATFORM_WINDOWS
;
92 //////////////////////////////////////////////////////////////////////
93 // Exported global symbols
96 DWORD real_WIN32_IE
= 0;
99 // macro to convert version numbers to hex format
100 #define CNV_OS_VER(x) ((BYTE)(((BYTE)(x) / 10 * 16) | ((BYTE)(x) % 10)))
102 void InitRealVersions()
104 CheckCommCtrlsVersion();
107 switch (g_dviCommCtrls
.dwMajorVersion
)
110 switch (g_dviCommCtrls
.dwMinorVersion
)
113 real_WIN32_IE
= 0x0300;
116 real_WIN32_IE
= 0x0400;
119 real_WIN32_IE
= 0x0401;
122 real_WIN32_IE
= 0x0200;
126 if (g_dviCommCtrls
.dwMinorVersion
> 80)
127 real_WIN32_IE
= 0x0501;
129 real_WIN32_IE
= 0x0500;
132 real_WIN32_IE
= 0x0600; // includes checks for 0x0560 (IE6)