简体   繁体   English

将特定文件或文件夹添加到Windows资源管理器视图

[英]Adding specific files or folders to a windows explorer view

I've been working on a tagging program for my computer. 我一直在为我的电脑做一个标记程序。 I need to the ability to pass a list of files or folders into an explorer (or something similar) to display them and be able to manipulate them much like you would do with a folder view in Windows. 我需要能够将文件或文件夹列表传递到资源管理器(或类似的东西)以显示它们,并且能够像操作Windows中的文件夹视图一样操纵它们。

I've already written the software which records and stores tags relative to file's path on the computer, and I can search through them dynamically creating a list of paths, but the next part I'm a little stumped on. 我已经编写了在计算机上记录和存储相对于文件路径的标签的软件,我可以通过它们动态创建路径列表进行搜索,但下一部分我有点难过。

Even if there is a solution where I fool the operating into thinking the files are within a "temp" folder and simply display that, that would be perfect. 即使有一个解决方案,我愚弄操作认为文件在“临时”文件夹中,只是显示,这将是完美的。

I'm written everything in C# so far, but I am not picky on the language. 到目前为止,我用C#编写了所有内容,但我并不挑剔语言。

Thanks in advance! 提前致谢!

IExplorerBrowser control is the native interface for using the "Windows Explorer" control. IExplorerBrowser控件是使用“Windows资源管理器”控件的本机接口。 This has been wrapped in a .NET way in Windows API Code Pack for .NET framework ( http://code.msdn.microsoft.com/WindowsAPICodePack ) 这已经在Windows API Code Pack for .NET框架中以.NET方式包装( http://code.msdn.microsoft.com/WindowsAPICodePack

You could start by using that control (there is a WPF and winforms version, with events, collections you can bind to, tons of properties/flags to set, etc). 您可以从使用该控件开始(有一个WPF和winforms版本,包含事件,可以绑定的集合,要设置的大量属性/标志等)。

If that doesn't give you the desired control, you can move on to the actual Shell objects. 如果这不能提供所需的控件,则可以转到实际的Shell对象。 The library above also provides access different types of Shell objects- files, folders, virtual items such as control panel, other known folders, etc. You can look at their Shell samples and see the usage. 上面的库还提供访问不同类型的Shell对象 - 文件,文件夹,虚拟项目(如控制面板),其他已知文件夹等。您可以查看其Shell示例并查看用法。

In short, you can use a ListBox-like control in your app and display the types of files/folders (anything that is represented in Shell). 简而言之,您可以在应用程序中使用类似ListBox的控件,并显示文件/文件夹的类型(Shell中表示的任何内容)。 You can also get rich information about each object, like their thumbnail/icon, properties, etc. 您还可以获取有关每个对象的丰富信息,例如缩略图/图标,属性等。

Create your own directory viewer. 创建自己的目录查看器。 However, it will be quite a challenging and time/money consuming task. 然而,这将是一个非常具有挑战性和时间/金钱消耗的任务。

Variant 2: 变式2:

Create catalog with all your tagged tree structure (use links to all real files or just some id-s). 使用所有标记树结构创建目录(使用指向所有真实文件的链接或仅使用一些id-s)。

Show it in explorer. 在资源管理器中显示它。

Track changes in that catalog and do following changes in with your tagged data. 跟踪该目录中的更改,并对标记数据进行以下更改。

Sure you could create also temporary folders containing links to your tagged files and then embedding a explorer-control in your app which you could then let navigate to "file://c/temp/mytaggedfolder" or similar but.. 当然你也可以创建包含指向标记文件的链接的临时文件夹,然后在你的应用程序中嵌入一个资源管理器控件,然后你可以导航到“file:// c / temp / mytaggedfolder”或类似的但是..

What about simply add all data to a listView? 如何简单地将所有数据添加到listView? There is lot of example code for that on codeproject for example. 例如,在codeproject上有很多示例代码。

Do a search for IShellFolder and IShellView. 搜索IShellFolder和IShellView。 for example: http://www.codeproject.com/KB/shell/explorer.aspx 例如: http//www.codeproject.com/KB/shell/explorer.aspx

The interfaces are not especially simple to use, but not especially difficult either and they're quite powerful. 接口使用起来并不是特别简单,但也不是特别困难,它们非常强大。 from your description it sounds exactly like what you need to essentially host explorer's view within your app, point it at both the real filesystem and/or a custom namespace, and then customize/override the behavior. 根据您的描述,它听起来就像您需要在应用程序中实际托管资源管理器的视图,将其指向真实文件系统和/或自定义命名空间,然后自定义/覆盖行为。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Windows资源管理器中文件夹或文件的坐标 - Coordinates of Folders or Files in Windows Explorer 将多个文件/文件夹从Windows资源管理器传递到外部应用程序 - Pass multiple files / folders from windows explorer to external application 在Windows资源管理器和解决方案资源管理器中添加图像文件 - Adding image files in Windows Explorer vs. Solution Explorer 如何在C#中将文件夹/文件从一个Windows资源管理器拖放到另一个Windows资源管理器? - How to drag and drop folders/files from One Windows Explorer to another windows explorer in C#? 如何将文件和文件夹的ICON插入到treeView和listView中,如windows explorer? - how to get ICONs of files and folders to insert to treeView and listView like windows explorer? 关闭Windows资源管理器的特定实例 - Closing a Specific Instance of Windows Explorer 将程序添加到Windows资源管理器上下文菜单 - Adding program to the windows explorer context menu 将上下文菜单项添加到Windows资源管理器 - Adding a context menu item to windows explorer 使用复选框创建 WPF Windows 资源管理器树视图 - Create WPF windows explorer tree view with checkbox 复制Windows资源管理器更改视图控件 - Replicating Windows Explorer Change View Control
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM