Figure 1   Web View in Action

Figure 1 Web View in Action


Figure 2   Windows Explorer Shell Versions

Version Platform Interfaces Supported
4.0Windows 95, Windows NT 4.0, Internet Explorer 3.0, and Internet Explorer 4.0 without Web Integrated Desktop IShellFolder, IPersistFolder, IShellView, IEnumIDList, IExtractIcon, IContextMenu, IContextMenu2, IDataObject, IDropSource, and IdropTarget
4.71 Internet Explorer 4.0 with Web Integrated Desktop Same as version 4.00 plus IShellView2 and IContextMenu3
4.72 Internet Explorer 4.01 with Integrated Desktop, Windows 98 beta 3, and Windows NT 5.0 beta 1 Same as version 4.71 plus IPersistFolder2


Figure 3   GetShellVersion


 #include <windows.h>
 #include <shlwapi.h>
 
 HRESULT GetShellVersion(LPDWORD pdwMajorVersion, LPDWORD pdwMinorVersion)
 {
     HINSTANCE   hShell32 = NULL;
 
     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 ( NULL == hShell32 )
         return E_FAIL;
 
     HRESULT hr = S_OK;
     DLLGETVERSIONPROC pDllGetVersion = { 0 };
    
 
     //You must get this function explicitly because earlier versions of the DLL 
     //Do not implement this function.
 
     pDllGetVersion = (DLLGETVERSIONPROC)::GetProcAddress(hShell32,     
                                                          _T("DllGetVersion"));
    
     if (!pDllGetVersion )
     {
         ::FreeLibrary(hShell32);
         return E_FAIL;
     }
 
     DLLVERSIONINFO    DllVersionInfo;
       
     ZeroMemory(&DllVersionInfo, sizeof(DllVersionInfo));
     DllVersionInfo.cbSize = sizeof(DllVersionInfo);
    
     hr = (*pDllGetVersion)(&DllVersionInfo);
       
     if ( SUCCEEDED( hr ))
     {
         *pdwMajor = DllVersionInfo.dwMajorVersion;
         *pdwMinor = DllVersionInfo.dwMinorVersion;
     }
     else
     {
         // If the function does not exists, then the DLL is a version 
         // older than Internet Explorer 3.x
 
         *pdwMajor = 4;
         *pdwMinor = 0;
     }
    
     ::FreeLibrary(hShell32);
 
     return hr;
 }

Figure 5   STRRET Values

Value Meaning
STRRET_WSTR Use STRRET.pOleStr field by returning a unicode string allocated using the IMalloc object returned from SHGetMalloc
STRRET_OFFSET Use STRRET.uOffset field to tell Windows Explorer how many bytes from the start if the PIDL to where the title can be found in the PIDL
STRRET_CSTR Use STRRET.cStr to copy the ANSI string into this field


Figure 6   Object Attributes

GetAttributes Flag Meaning
SFGAO_CANCOPY Object can be copied
SFGAO_CANMOVE Object can be moved
SFGAO_CANLINK Object can be linked
SFGAO_CANRENAME Object can be renamed
SFGAO_CANDELETE Object can be deleted
SFGAO_HASPROPSHEET Object has property sheets
SFGAO_DROPTARGET Object is a drop target
SFGAO_LINK the Object is a shortcut (link)
SFGAO_SHARE the Object is shared
SFGAO_READONLY the Object is read-only
SFGAO_GHOSTED the Object should have a ghosted icon
SFGAO_HIDDEN the Object is a hidden object
SFGAO_FOLDER the Object is a folder
SFGAO_HASSUBFOLDER the Object has children


Figure 7   GetIconLocation


 HRESULT CADSIExtractIconA::GetIconLocation(UINT /*uFlags*/,
                                            LPSTR szIconFile, UINT cchMax, 
                                            int * piIndex, UINT * pwFlags)
 {
     // get the module file name
     if ( 0 ==::GetModuleFileNameA(_Module.GetModuleInstance(),
                                   szIconFile,cchMax) )
     {
         DWORD dwError = ::GetLastError();
         return HRESULT_FROM_WIN32(dwError);
     }
 
     // if there document is a place for the Icon Index
     if ( NULL != piIndex )
     {
         // by turning on the high order bit flags the values is a resource ID
         *piIndex = -1 * (int)m_dwIcon;
     }
 
     // set that there are no special requirements on the icons
     if ( NULL != pwFlags )
     {
         *pwFlags = 0;
     }
     // return all is well
     return S_OK;
 }
 
 HRESULT CADSIExtractIconA::Extract(LPCSTR /*pszFile*/,UINT /*nIconIndex*/,
     HICON * /*phiconLarge*/,HICON * /*phiconSmall*/,UINT /*nIconSize*/)
 {
     // tell the calling app to load the icon itself
     return S_FALSE;
 }



Figure 8   Classic View in Action

Figure 8 Classic View in Action


Figure 12   Shell View Activation States

State Definition
SVUIA_DEACTIVATE The view will be placed in this state when the Windows Explorer is about to destroy the shell view window. The shell view is required to remove the menus, toolbars, and any windows or UI objects that have been created.
SVUIA_ACTIVATE_NOFOCUS The view will be placed in this state when the namespace extension's shell view has just created a window. The shell view has been created without focus and should set the menus accordingly.
SVUIA_ACTIVATE_FOCUS The view will be placed in this state when Windows Explorer sets focus to the shell view window. The menus and view selections should reflect that the view has input focus.
SVUIA_INPLACEACTIVATE The view will be placed in this state when the shell view is opened within an ActiveX control. The view is not in a UI active state. In this case, the shell view should not merge menus or install toolbars. To be compatible with the Windows 95 client, this value is not passed unless the view supports IShellView2.