列表控制图标SHGetFileInfo [英] List Control Icons SHGetFileInfo
本文介绍了列表控制图标SHGetFileInfo的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hil = (HIMAGELIST)SHGetFileInfo( itemss, FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_ENCRYPTED|FILE_ATTRIBUTE_HIDDEN, &sfi, sizeof(sfi), SHGFI_USEFILEATTRIBUTES|SHGFI_SYSICONINDEX|SHGFI_SMALLICON|SHGFI_ICON);
我想用图像图标列出文件和导演。我只能获取文件。或者我只能获得导演。我知道它与旗帜的东西,但无法搞清楚。我用命令检查了纪录片并使用了所有的标志,但仍然无法工作
如果我只使用FILE_ATTRIBUTE_DIRECTORY,那么一切都是文件夹..甚至像*这样的文件。 sys
如果我只使用FILE_ATTRIBUTE_ARCHIVE,那么文件夹就不会列出.....
i在Winnt.h中查找..没有用
I want to list files and directorys with the image icons. I can only get files. Or I can get only directorys. I know its something with the flags but can not figure it out. I checked documentary with the command and used all the flags but still does not work
If i just use FILE_ATTRIBUTE_DIRECTORY, than everything is a folder..even files like *.sys
If i just use FILE_ATTRIBUTE_ARCHIVE, then folders don't get listed.....
i looked in Winnt.h..nothing works
推荐答案
当使用SHGFI_USEFILEATTRIBUTES
标志时,dwFileAttributes
参数指定传递的文件名是目录还是文件。所以你必须传递特定文件的属性而不是属性的组合。
我假设你使用CFileFind
或FindFirstFile()
/FindNextFile()
获取文件列表。然后使用这些函数提供的属性或只需FILE_ATTRIBUTE_DIRECTORY
获取目录,使用FILE_ATTRIBUTE_NORMAL
获取文件。
When using theSHGFI_USEFILEATTRIBUTES
flag, thedwFileAttributes
parameter specifies if the passed file name is a directory or a file. So you must pass the attribute of the specific file and not a combination of attributes.
I assume that you are usingCFileFind
orFindFirstFile()
/FindNextFile()
to get the file list. Then use the attributes provided by these functions or justFILE_ATTRIBUTE_DIRECTORY
for directories andFILE_ATTRIBUTE_NORMAL
for files.
这篇关于列表控制图标SHGetFileInfo的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文