使用SHOpenFolderAndSelectItems,打开文件夹并选中其中的文件
//@sFile 要打开的文件夹
//@lFilelist 文件夹下面的文件,要确保存在
void im_file_ui_wnd::OpenDirAndSelectFiles(et_nano_wui::tstring const &sFile, et_nano_wui::tstringlist const &lFilelist)
{
if (sFile.empty())return;
ITEMIDLIST *dir = ILCreateFromPath(sFile.c_str());
ITEMIDLIST ** selection = new ITEMIDLIST* [lFilelist.size()];
et_nano_wui::tstringlist::const_iterator _it = lFilelist.begin();
int _index = 0;
for ( ; _it!=lFilelist.end(); _it++,_index++)
{
*(selection+_index) = ILCreateFromPath( (sFile + (*_it)).c_str() );
}
//Perform selection
SHOpenFolderAndSelectItems(dir, lFilelist.size(), (LPCITEMIDLIST *)(selection), 0);
//Free resources
ILFree(dir);
for (_index=0; _index!=lFilelist.size(); _index++)
{
ILFree(*(selection+_index));
}
}