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 canít 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.
Hereís 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?
// pChild is the current child IShellItem returned by the parent IEnumShellItem
pChild->BindToHandler(NULL,BHID_EnumItems,IID_IEnumShellItems,(void**)&pEnum); // works with the original pChild
SHGetIDListFromObject(pChild,&pidl); // convert IShellItem to pidl
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 doesnít 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.
P.S. I am using the latest trial version 18.104.22.168 on 64-bit Windows 7 Ultimate