在Windows资源管理器中以编程方式选择多个文件 [英] Programmatically select multiple files in windows explorer

查看:108
本文介绍了在Windows资源管理器中以编程方式选择多个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在Windows资源管理器中显示并选择一个文件,如下所示:

I can display and select a single file in windows explorer like this:

explorer.exe /select, "c:\path\to\file.txt"

但是,我不知道如何选择多个文件.我尝试过的select的排列都没有.

However, I can't work out how to select more than one file. None of the permutations of select I've tried work.

注意:我在这些页面上查看了文档,但都没有帮助.

Note: I looked at these pages for docs, neither helped.

https://support.microsoft.com/kb/314853
http://web.archive.org/web/20100716112458/http://www.infocellar.com:80/Win98/explorer-switches.htm

推荐答案

使用shell函数

This should be possible with the shell function SHOpenFolderAndSelectItems

编辑

下面是一些示例代码,显示了如何在C/C ++中使用该功能,而没有进行错误检查:

Here is some sample code showing how to use the function in C/C++, without error checking:

//Directory to open
ITEMIDLIST *dir = ILCreateFromPath(_T("C:\\"));

//Items in directory to select
ITEMIDLIST *item1 = ILCreateFromPath(_T("C:\\Program Files\\"));
ITEMIDLIST *item2 = ILCreateFromPath(_T("C:\\Windows\\"));
const ITEMIDLIST* selection[] = {item1,item2};
UINT count = sizeof(selection) / sizeof(ITEMIDLIST);

//Perform selection
SHOpenFolderAndSelectItems(dir, count, selection, 0);

//Free resources
ILFree(dir);
ILFree(item1);
ILFree(item2);

这篇关于在Windows资源管理器中以编程方式选择多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆