WindowsShellService.CreateObjectForParsingName LargeIcon is null

Shell for WPF Forum

Posted 4 years ago by rex hui
Version: 19.1.0685
Platform: .NET 3.0 (Core)
Environment: Windows 10 (64-bit)
Avatar
public MainWindow()
{
   InitializeComponent();

   WindowsShellService sh = new WindowsShellService();
   var shTmp = sh.CreateObjectForParsingName(@"C:\Users\rex_h\AppData\Local\Temp");
   var item = shTmp.Children[0];
   
   if (item.SmallIcon == null)
      Debug.WriteLine("SmallIcon is null");
   if (item.MediumIcon == null)
      Debug.WriteLine("MediumIcon is null");
   if (item.LargeIcon == null)
      Debug.WriteLine("LargeIcon is null");
   if (item.ExtraLargeIcon == null)
      Debug.WriteLine("ExtraLargeIcon is null");
}

I do not understand why LargeIcon is null while all the other icons have values.

Comments (4)

Posted 4 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Rex,

Yes that is because "large" icons in Windows shell controls show at 96x96 resolution (in Windows Explorer).  Yet there is no 96x96 system image list for icons in Windows itself, like there is for the other sizes.

Thumbnails can come in at 96x96 though.  What happens in our shell controls is that a wrapper around the core Windows shell object will end up using and resizing the "extra large" size icon from the core Windows shell object if a "large" size icon is requested.


Actipro Software Support

Posted 4 years ago by rex hui
Avatar

Thank you.

I see but if the shell control is creating the large image by resizing the extra large one, how come it is still returning null? It looks like sometimes, it does return a value.

Answer - Posted 4 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Rex,

There are a couple "layers" in the API.  There is the core Windows shell layer that implements IShellObject and related objects specifically for the Windows system.  Then a second ShellObjectViewModel layer wraps a core IShellObject and has the logic for doing that additional icon mapping.  

In your scenario here, you are interacting with the core Windows shell layer, which is returning null since it doesn't have an image of that particular size (96x96) available from a known system image list.  I suppose we could return the ExtraLarge icon (256x256 size) if the Large one isn't found there.  Is that would you'd like to see happen?


Actipro Software Support

Posted 4 years ago by rex hui
Avatar

I understand now. Thank you very much!

The latest build of this product (v24.1.3) was released 26 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.