I solved it today
It seems the component did everything OK, but the wrong way, that's why I got a folder icon instead of the default desktop icon - the component asked for the icon of the desktop folder by it's path, not PIDL.
Here's how I got it to appear (in a demo application for a custom places bar):
- Code: Select all
//k is a value of a CSIDL_ constant, for Desktop it's 0
function GetPlaceInfo(k: integer): RPlaceInfo;
var
PIDL: PItemIDList;
IDesktopFolder: IShellFolder;
StrRet: TStrRet;
Malloc: IMalloc;
FileInfo: TShFileInfo;
begin
if Succeeded(SHGetSpecialFolderLocation(0, k, PIDL)) then
begin
//returns the "path" of the special folder, something like "::{xxxx-xxxx-...}" (pardon my ignorance, I'm slowly getting to know the shell, I didn't bother with it much before)
if Succeeded(SHGetDesktopFolder(IDesktopFolder)) and Succeeded(IDesktopFolder.GetDisplayNameOf(PIDL, SHGDN_NORMAL or SHGDN_FORPARSING, StrRet)) then
Result.Path := StrRetToString(PIDL, StrRet)
else
Result.Path := '';
//I'm not sure I need all 3 of the last parameters
SHGetFileInfo(PChar(PIDL), 0, FileInfo, SizeOf(FileInfo), SHGFI_PIDL or SHGFI_DISPLAYNAME or SHGFI_ICONLOCATION or SHGFI_SYSICONINDEX or SHGFI_ICON);
//Get's the name of the special folder
Result.DisplayName := FileInfo.szDisplayName;
//Here I get the ImageIndex and use it with the DELPHI AREA SystemImageList and it displays the correct icon :))
Result.ImageIndex := FileInfo.iIcon;
//I'm not sure I need these two lines, are they necessary, should they be here, please comment...
ShGetMalloc(Malloc);
Malloc.Free(PIDL);
end;
end;
I still have to figure out how to get the description of the special folder, I found it in the registry under MUICache, which doesn't help at all, but I'm sure there's a way to get it.
Anyway, thanks for the great components (sysimagelist, printpreview, gradient, picshow), I haven't used all of them, but they're more than useful
If you'd like to try some of mine feel free to, they're completely free and can be found at
http://mxs.bergsoft.net