Hi
I am developing a start menu replacement for Windows 7, 8 and 8.1. I am having problems browsing the ZENworks namespace. Shell items inside the namespace do not behave correctly. I cant get their icons or their child items. You can see an example in this forum thread: View topic - Classic Shell v4.0 and Novell ZENworks 11.2
I think I have tracked down the cause of the problem. I am using the IEnumShellItem interface to get the child IShellItems, but then I convert them to PIDLs for later use. The reason I use PIDLs is that they are pure data and I can safely pass them between threads (for example I can use a background thread to load the icons). The problem is that the round-trip conversion IShellItem -> PIDL -> IShellItem creates a shell item that has only partial functionality. Calling BindToHandler for things like IID_IEnumShellItem or IID_IExtractIcon fails.
Heres my code example:
Is this a known problem and are there any plans to fix it? Can you suggest an alternative to the pair of functions SHGetIDListFromObject/SHCreateItemFromIDList that can produce a more reliable result?
Also the PIDL I get doesnt work with SHGetFileInfo, which makes retrieving the icon more difficult. As a workaround I try to use the IExtractIcon, but it has the problem that its GetIconLocation function returns an empty location string. While it may be permitted by Windows, it breaks my code because I use the location as a key in my icon cache.
Regards
Ivo Beltchev
Classic Shell
www.classicshell.net
P.S. I am using the latest trial version 11.2.0.0 on 64-bit Windows 7 Ultimate
I am developing a start menu replacement for Windows 7, 8 and 8.1. I am having problems browsing the ZENworks namespace. Shell items inside the namespace do not behave correctly. I cant get their icons or their child items. You can see an example in this forum thread: View topic - Classic Shell v4.0 and Novell ZENworks 11.2
I think I have tracked down the cause of the problem. I am using the IEnumShellItem interface to get the child IShellItems, but then I convert them to PIDLs for later use. The reason I use PIDLs is that they are pure data and I can safely pass them between threads (for example I can use a background thread to load the icons). The problem is that the round-trip conversion IShellItem -> PIDL -> IShellItem creates a shell item that has only partial functionality. Calling BindToHandler for things like IID_IEnumShellItem or IID_IExtractIcon fails.
Heres my code example:
Code:
// pChild is the current child IShellItem returned by the parent IEnumShellItem
IEnumShellItems *pEnum;
pChild->BindToHandler(NULL,BHID_EnumItems,IID_IEnumShellItems,(void**)&pEnum); // works with the original pChild
PIDLIST_ABSOLUTE pidl;
SHGetIDListFromObject(pChild,&pidl); // convert IShellItem to pidl
IShellItem *pChild2;
SHCreateItemFromIDList(pidl,IID_IShellItem,(void**)&pChild2); // convert pidl to IShellItem
pChild2->BindToHandler(NULL,BHID_EnumItems,IID_IEnumShellItems,(void**)&pEnum); // fails with error 0x80004002 (E_NOINTERFACE)
Also the PIDL I get doesnt work with SHGetFileInfo, which makes retrieving the icon more difficult. As a workaround I try to use the IExtractIcon, but it has the problem that its GetIconLocation function returns an empty location string. While it may be permitted by Windows, it breaks my code because I use the location as a key in my icon cache.
Regards
Ivo Beltchev
Classic Shell
www.classicshell.net
P.S. I am using the latest trial version 11.2.0.0 on 64-bit Windows 7 Ultimate