还有一种方法是,做个ShellHook(JCL有个控件TjvShellHook,可直接放在你的程序中),监听消息。 具体消息类型参考:http://msdn.microsoft.com/en-us/library/bb774198(v=vs.85).aspx 其中有关文件操作的相关消息如下: FM_GETFILESEL Sent by a File Manager extension to retrieve information about a selected file from the active File Manager window (either the directory window or the Search Results window).
FM_GETFILESELLFN Sent by a File Manager extension to retrieve information about a selected file from the active File Manager window (either the directory window or the Search Results window). The selected file can have a long file name.
FM_GETFOCUS Sent by a File Manager extension to retrieve the type of File Manager window that has the input focus.
FM_GETSELCOUNT Sent by a File Manager extension to retrieve a count of the selected files in the active File Manager window (either the directory window or the Search Results window).
FM_GETSELCOUNTLFN Sent by a File Manager extension to retrieve the number of selected files in the active File Manager window (either the directory window or the Search Results window). The count includes files that have long file names.
以.abc的扩展名,关联起来,运行就没有问题的,可能是你的那个"程序"有问题
发消息的这种方式,我就不知道什么时候消息列表发送完了。比如选中了20个文件。那么就要怎么才知道发送了20次消息。
这个数字是未知的。如果我收到消息后就发给函数,那么就要调用20次函数。而这个函数又带窗口,就会弹出20个窗口文件。显然这样处理不是最佳我想实现的就是一次性传完这个LIST。在函数中处理这个LIST中的成员就行了。
应该能得到一个所选文件的列表吧
不知道什么api能得到
把文件当参数传给程序。
发现打开200多个文件的时候,很慢。并且鼠标会闪动很久。
这不是我想要的。
我想要的就是选中N个文件,然后打开如敲回车就像迅雷看看一样,很快的得到选中文件的列表。他是怎么做的呢?
此服务提供两个主要功能:
1、获取当前的ShellBrowser,依次取得当前浏览的Folder,再遍历取得处于Focus的Item(也就是文件),并添加到列表中;
2、启动自己的程序:先遍历自己的程序是否打开,若未打开,则运行一个实例;找到实例后,传入1结果关于第一个功能,可以参考 http://blogs.msdn.com/b/oldnewthing/archive/2004/07/20/188696.aspx
具体消息类型参考:http://msdn.microsoft.com/en-us/library/bb774198(v=vs.85).aspx
其中有关文件操作的相关消息如下:
FM_GETFILESEL
Sent by a File Manager extension to retrieve information about a selected file from the active File Manager window (either the directory window or the Search Results window).
FM_GETFILESELLFN
Sent by a File Manager extension to retrieve information about a selected file from the active File Manager window (either the directory window or the Search Results window). The selected file can have a long file name.
FM_GETFOCUS
Sent by a File Manager extension to retrieve the type of File Manager window that has the input focus.
FM_GETSELCOUNT
Sent by a File Manager extension to retrieve a count of the selected files in the active File Manager window (either the directory window or the Search Results window).
FM_GETSELCOUNTLFN
Sent by a File Manager extension to retrieve the number of selected files in the active File Manager window (either the directory window or the Search Results window). The count includes files that have long file names.