飞天神龟 2019-08-21 21:06 采纳率: 33.3%
浏览 754
已采纳

c++如何打开某个文件夹并选中多个文件

图片说明
就像图中那样,在打开某个目录的同时可以选择多个文件。网上查到可以用Explorer.exe /select实现这样的效果,但是我不知道Explorer.exe能不能选择多个文件

  • 写回答

1条回答 默认 最新

  • threenewbee 2019-08-21 22:47
    关注
    //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);
    

    https://stackoverflow.com/questions/9355/programmatically-select-multiple-files-in-windows-explorer

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?