65.9K
CodeProject 正在变化。 阅读更多。
Home

SeaShell - 更多 Explorer 控件

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.92/5 (17投票s)

2000年8月1日

viewsIcon

228644

downloadIcon

3696

一组 Shell 控件和其他有用的类。

  • 下载演示项目 - 277 Kb
  • Sample Image - seashell.jpg

    引言

    SeaShell 包含一组类,提供三个主要控件

    • CIEShellTreeCtrl
    • CIEShellListCtrl
    • CIEShellComboBox

    它们可以独立使用,也可以像在 Explorer 中那样集成


    特点

    • 完全支持拖放,包括右键菜单和从/向 Windows Explorer 拖放
    • 支持上下文菜单,包括 Owner Draw,SendTo 以及新的 OpenWith(仅限 W2K)菜单
    • 树形控件和列表控件均可自动刷新
    • 支持使用通配符进行过滤,例如 *.cpp *.htm 或基于文件类型
    • 使用 Explorer 中的设置来以不同的颜色显示压缩文件,双击打开文件等。
    • 所有三个控件之间的完整集成


    历史

    这是第一个版本,预计会出现问题

    用法

    首先,您必须在 stdafx.h 文件中包含 SeaShellExt.h,并且您需要包含 SeaShellExt 子文件夹中的所有文件,如果您打算仅在对话框中使用它,则可以排除框架和视图文件。演示程序演示了如何在框架窗口和对话框中使用它。

    这是将所有控件添加到对话框中需要执行的操作

    将此代码添加到 OnInitDIalog 函数

       // Point the combo box to the tree control(optional)
       m_cbShell.SetTreeCtrlWnd(m_tcShell.GetSafeHwnd());
    
       // Point the tree control to the list control(optional)
       m_tcShell.SetListCtrlWnd(m_lcShell.GetSafeHwnd());
    
       // Point the tree control to the combo box(optional)
       m_tcShell.SetComboBoxWnd(m_cbShell.GetSafeHwnd());
    
       // Populate the tree starting from the desktop
       m_tcShell.LoadFolderItems();
    
       // or populate the tree starting from a system file path
       // m_tcShell.LoadFolderItems(_T("C:\\folder1\\folder2"));
    

    要在 CView 中连接控件,请查看随附的演示程序,其中包含 CIEShellTreeViewCIEShellListView 类,您可以使用这些类。

    关于框有一个列表控件的演示,该列表控件没有 Shell 支持,它以类似于 Napster 的方式将进度条添加到列中(如果有人见过)。感谢 Chris Maunder 提供的 CTextProgressCtrl,我对其进行了轻微修改。

    CHtmlView 有有限的支持,可以在单击 Internet Explorer 文件夹时显示 Web 浏览器。但这在对话框中不起作用。


    致谢

    它还包含来自其他来源的一些文件,最值得注意的是

  • CoolMenu 来自 Paul DiLascia (MSJ)
  • ShellContextMenu 来自 Oz Solomonovich (WndTabs)
  • InPlaceEdit 来自 Zafir Anjum (Codeguru)


  • 还有一些其他的代码片段,但我记不清是从哪里来的了。

    谢谢大家

    如果有人想将其转换为 MFC 扩展 DLL,大多数类中都使用了一个宏 CTRL_EXT_CLASS,这将有所帮助。

    最后一点,我使用 W2K 的平台 SDK 进行编译,但我包含了一个文件 W2KFix.h,该文件定义了它需要的 COM 接口。

    © . All rights reserved.