I have a simple file browser and there I display files and folders,
obtained by (for directory)
SHFILEINFO info = new SHFILEINFO();
SHGetFileInfo(filename,
FILE_ATTRIBUTE_DIRECTORY,
ref info,Marshal.SizeOf(info),
SHGFI_ICON | SHGFI_USEFILEATTRIBUTES | SHGFI_SMALLICON | SHGFI_ADDOVERLAYS);
It works 100% fine, but I have noticed an oddity - if I try to obtain an icon for directory, but specify FILE_ATTRIBUTE_NORMAL in开发者_如何学运维stead of FILE_ATTRIBUTE_DIRECTORY but it does weird stuff for directories - normal folders have "unknown file type white paper" icons, recycle bin has VLC icon, etc. Directories under SVN have proper overlay, but base file icon (white sheet of paper).
I understand that base icon for directory would now be the one of unknown file, but why do some folders have totally strange icon? Config.MSI has installer icon, recycle bin has VLC icon (wtf?!), etc. What does the shell function do with this parameters? Exactly what icon does it obtain?
Again, this is not a problem, I'm just curious.
As far as I know icon resources are accessed by their numeric index, so my guess is that the right index is fetched, and the icon is then fetched from either the wrong library, or from the right one but using wrong offset+correct index.
精彩评论