views:

88

answers:

1

I have a Visual Studio 2008 C++ ATL project that is a namespace extension for Windows Explorer.

In the tool bar rebar for Windows Explorer in Windows XP, there is an icon labeled "views". In a normal view, it creates a drop-down menu that allows the user to select "Thumbnails", "Tiles", "Icons", "List", or "Details" as the view type.

What interface do I need to implement in my project for this button? At present, I implement IShellFolder and IShellView. When I click the "Views" button while in my namespace, nothing happens. No menu is shown and the user is not given the option of changing views.

Thanks, PaulH


Edit: This is my implementation of IShellView, IServiceProvider, and IFolderView

class ATL_NO_VTABLE CShellViewImpl :
    public CComObjectRootEx< CComSingleThreadModel >,
    public CComCoClass< CShellViewImpl, &CLSID_ShellViewImpl >,
    public IDispatchImpl< IShellViewImpl, 
                          &IID_IShellViewImpl, 
                          &LIBID_MyLib, 
                          /*wMajor =*/ 1, 
                          /*wMinor =*/ 0 >,
    public IShellView,
    public IServiceProvider,
    public IFolderView
{
public:
    DECLARE_REGISTRY_RESOURCEID( IDR_SHELLVIEWIMPL )

    BEGIN_COM_MAP( CShellViewImpl )
        COM_INTERFACE_ENTRY( IShellViewImpl )
        COM_INTERFACE_ENTRY( IServiceProvider )
        COM_INTERFACE_ENTRY( IDispatch )
        COM_INTERFACE_ENTRY( IShellView )
        COM_INTERFACE_ENTRY( IFolderView )
    END_COM_MAP()

    DECLARE_PROTECT_FINAL_CONSTRUCT()

    // IXYZ implementations...
};

IServiceProvider::QueryService() is never called

A: 

Try IFolderView::SetCurrentViewMode

Sheng Jiang 蒋晟
I've implemented IFolderView, but none of its functions get called even when I click the Explorer "view" button. It's possible I've implemented it incorrectly. Does it require any additional registry entries in the project .rgs files? Is there a link to an example of a working implementation I could look at?
PaulH
I think you need to implement IServiceProvider and respond SID_SFolderView
Sheng Jiang 蒋晟
@Sheng Jiang - See my edit. I've implemented `IServiceProvider` as you suggested, but `QueryService()` is never called.
PaulH
Where is your IShellBrowser implementation?
Sheng Jiang 蒋晟
I think you need to implement IShellView2 also.
logicnp