Shell VersionsShell Versions*
*Contents  *Index  *Topic Contents
*Previous Topic: Windows Shell API
*Next Topic: Application Desktop Toolbars

Shell Versions


Microsoft® Internet Explorer 4.0 introduces updates to shell interfaces, functions, and other programming elements. This section describes how to determine which version your application is running on and how to target your application for a specific version.

arrowy.gifShell DLL Versions

arrowy.gifProject Versions

Shell DLL Versions

Because of ongoing enhancements, different versions of Shell32.dll implement different features. Throughout this section, programming elements are marked with a version number. This version number indicates that the programming element is implemented in that version and later versions of Shell32.dll. If no version number is specified, the programming element is implemented in all versions. Many programming elements are now contained in Shdocvw.dll, but this file was not included with standard Microsoft® Windows® 95 or Windows NT® 4.0 operating systems. Therefore, Shell32.dll will provide the required version information.

The following table outlines the different versions of Shell32.dll and the platforms on which they are contained.
VersionPlatform
4.00Windows 95, Windows NT 4.0, Internet Explorer 3.0, and Internet Explorer 4.0 without Web Integrated Desktop.
4.71Internet Explorer 4.0 with Web Integrated Desktop.
4.72Internet Explorer 4.01 with Web Integrated Desktop.

The following function retrieves the major and minor version numbers of the Shell32.dll that is installed on the local system.

#include <windows.h>
#include <shlwapi.h>

HRESULT GetShell32Version(LPDWORD pdwMajor, LPDWORD pdwMinor)
{
HINSTANCE   hShell32;

if(   IsBadWritePtr(pdwMajor, sizeof(DWORD)) || 
      IsBadWritePtr(pdwMinor, sizeof(DWORD)))
   return E_INVALIDARG;

*pdwMajor = 0;
*pdwMinor = 0;

//Load the DLL.
hShell32 = LoadLibrary(TEXT("shell32.dll"));

if(hShell32)
   {
   HRESULT           hr = S_OK;
   DLLGETVERSIONPROC pDllGetVersion;
   
   /*
   You must get this function explicitly because earlier versions of the DLL 
   don't implement this function. That makes the lack of implementation of the 
   function a version marker in itself.
   */
   pDllGetVersion = (DLLGETVERSIONPROC)GetProcAddress(hShell32, TEXT("DllGetVersion"));
   
   if(pDllGetVersion)
      {
      DLLVERSIONINFO    dvi;
      
      ZeroMemory(&dvi, sizeof(dvi));
      dvi.cbSize = sizeof(dvi);
   
      hr = (*pDllGetVersion)(&dvi);
      
      if(SUCCEEDED(hr))
         {
         *pdwMajor = dvi.dwMajorVersion;

         *pdwMinor = dvi.dwMinorVersion;
         }
      }
   else
      {
      /*
      If GetProcAddress failed, the DLL is a version previous to the one 
      shipped with IE 3.x.
      */
      *pdwMajor = 4;
      *pdwMinor = 0;
      }
   
   FreeLibrary(hShell32);

   return hr;
   }

return E_FAIL;
}

Project Versions

To help you ensure that your application is compatible with different targeted versions of the shell, a version macro has been added to the shell header files. This version macro is used to define, exclude, or redefine certain definitions for different versions of the DLL. The macro name is _WIN32_IE, and you, the developer, are responsible for defining the macro as a hexadecimal number. This version number defines the target version of the application that is using the DLL. The following are the currently available version numbers and the effect each has on your application.
VersionDescription
0x0200The application will be compatible with Shell32.dll version 4.00 and later. The application will not, however, be able to implement the features that were added after version 4.00 of Shell32.dll.
0x0400The application will be compatible with Shell32.dll version 4.71 and later. The application will not, however, be able to implement the features that were added after version 4.71 of Shell32.dll.
0x0401The application will be compatible with Shell32.dll version 4.72 and later. The application will not, however, be able to implement the features that were added after version 4.72 of Shell32.dll.

The most effective way to define this macro in your project is to add the following to the compiler directives in your make file (substitute the desired version number for 0x0400).

/D _WIN32_IE=0x0400 

Another method that can be used is to add a line similar to the following in your source code before including any header files (substitute the desired version number for 0x0400).

#define _WIN32_IE 0x0400
#include <shlobj.h>

If you do not define this macro in your project, it will automatically be defined as 0x0400.


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.