With each Windows operating system update, and each update of Internet Explorer,
we are issued with a new version of the system libraries Comctl32.dll, Shell32.dll,
and Shlwapi.dll. These libraries contain the bulk of the code that handles the
common control and shell functionality of windows. The problem is, each version is
different, and it can sometimes be critical to know which platform you are
targeting when writing software that specifically uses functionality in these
Below is a list of library versions, and the platforms you would expect to find
||Microsoft Windows 95/Windows NT 4.0|
||Microsoft Internet Explorer 3.x|
||Microsoft Internet Explorer 4.0 |
||Microsoft Internet Explorer 4.01 and Windows 98 |
||Microsoft Windows 2000 and Internet Explorer 5
There are a couple of points here:
Firstly, For Windows 95, Internet Explorer 4.0 can be installed without the integrated
shell. Thus, you may have either version 4.71 or 4.72 of Comctl32.dll or Shlwapi.dll
on a Windows 95 box, but the version of Shell32.dll may be different. On a Windows 98
system all three libraries will have the same value.
Secondly, Internet Explorer will update Comctl32.dll and Shlwapi.dll to version 5.0,
but will not update the Shell32.dll library. Thus, if you install IE 5 on a non-Windows
2000 system, your Shell32.dll version will again be different to your Comctl32.dll and
So how do you test?
Microsoft kindly provides us with a handy function to test for the various
#define PACKVERSION(major,minor) MAKELONG(minor,major)
DWORD GetDllVersion(LPCTSTR lpszDllName)
DWORD dwVersion = 0;
hinstDll = LoadLibrary(lpszDllName)
pDllGetVersion = (DLLGETVERSIONPROC) GetProcAddress(hinstDll, "DllGetVersion");
dvi.cbSize = sizeof(dvi);
hr = (*pDllGetVersion)(&dvi);
dwVersion = PACKVERSION(dvi.dwMajorVersion, dvi.dwMinorVersion);
It's noted that the above will work only for version 4.71 and above of the libraries.
So - to use the above function in your code, you would do something like the following:
if (GetDllVersion(TEXT("comctl32.dll")) >= PACKVERSION(4,71))
Chris is the Co-founder, Administrator, Architect, Chief Editor and Shameless Hack who wrote and runs The Code Project. He's been programming since 1988 while pretending to be, in various guises, an astrophysicist, mathematician, physicist, hydrologist, geomorphologist, defence intelligence researcher and then, when all that got a bit rough on the nerves, a web developer. He is a Microsoft Visual C++ MVP both globally and for Canada locally.
His programming experience includes C/C++, C#, SQL, MFC, ASP, ASP.NET, and far, far too much FORTRAN. He has worked on PocketPCs, AIX mainframes, Sun workstations, and a CRAY YMP C90 behemoth but finds notebooks take up less desk space.
He dodges, he weaves, and he never gets enough sleep. He is kind to small animals.
Chris was born and bred in Australia but splits his time between Toronto and Melbourne, depending on the weather. For relaxation he is into road cycling, snowboarding, rock climbing, and storm chasing.