实现 Windows 资源管理器扩展视图界面

发布于 2024-09-06 12:06:44 字数 1336 浏览 10 评论 0原文

我有一个 Visual Studio 2008 C++ ATL 项目,它是 Windows 资源管理器的命名空间扩展。

在 Windows XP 中 Windows 资源管理器的工具栏中,有一个标记为“视图”的图标。在普通视图中,它会创建一个下拉菜单,允许用户选择“缩略图”、“平铺”、“图标”、“列表”或“详细信息”作为视图类型。

我需要在我的项目中为此按钮实现什么接口?目前,我实现了IShellFolder和IShellView。当我在命名空间中单击“视图”按钮时,没有任何反应。不显示菜单,并且用户没有更改视图的选项。

谢谢, PaulH


编辑:这是我对 IShellView、IServiceProvider 和 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() 从未被调用

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

攀登最高峰 2024-09-13 12:06:44

尝试 IFolderView::SetCurrentViewMode

Try IFolderView::SetCurrentViewMode

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文