
SHGetFileInfo, producing unexpected results...
After spending a fair amount of time playing w/ the SHGetFileInfo function, I have
come across a host of inconsistencies when specifying the following values for
it's uFlags parameter. I'd like to hear if anyone else encountered anything similar
or has any idea why this behavior may be occurring...
1. Subtle and potentially system draining, when SHGFI_ICON is specified
a copy of the icon pointed to by the hIcon member of SHFILEINFO is
created. DestroyIcon must be called in order to free system resources
it occupies. This could almost be expected...
2. SHGFI_ICON does NOT return the handle of the system image list as it
should, instead it only returns a BOOL, regardless if used alone or OR'd w/
any other combination of flags.
3. Similarly, SHGFI_SHELLICONSIZE does not return the handle of the system
image list, it only returns a BOOL, regardless if used alone or OR'd w/ any
other combination of flags.
4. When the SHGFI_SHELLICONSIZE flag is OR'd w/ any combination of icon
flags, the size of the icon pointed to by the hIcon member is always 32x32
pixels, regardless of the Icon settings in the Appearance or Plus! tabs of
Control Panel's Display properties. DrawIconEx must be use to adjust the
icon to it's proper size.
5. The SHGFI_ICONLOCATION flag fills the SHFILEINFO szDisplayName
member only on a few occasions, i.e. when the associated icon of the file
specified in the SHGetFileInfo's pszPath param resides in certain system
files, regardless if the specified file is an exe or a file associated w/ an exe.
I have found the remaining flag combinations that were not listed above to
return intended results.
BTW there's nothing in the MSKB, the MS site, the web or in any newsgroup
regarding any of this.
Oh, and while I'm on the subject, has anyone figured out what the following
definitions found all by themselves at the bottom of Shellapi.h apply to...?
(SHGNLI = SHGenerateNewLinkI__ ...?!)
#define SHGNLI_PIDL 0x000000001 // pszLinkTo is a pidl
#define SHGNLI_PREFIXNAME 0x000000002 // Make name "Shortcut to xxx"
#define SHGNLI_NOUNIQUE 0x000000004 // don't do the unique name generation
Thanks
--
============
Brad Martinez
http://www.*-*-*.com/
============