WindowsShellService.CreateObjectForParsingName LargeIcon is null

Shell for WPF Forum

The latest build of this product (v2019.1 build 0685) was released 4 months ago, which was before this thread was created.
Posted 23 days ago by rex hui
Version: 19.1.0685
Platform: .NET Core 3.0
Environment: Windows 10 (64-bit)
public MainWindow()

   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 20 days ago by Actipro Software Support - Cleveland, OH, USA

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 20 days ago by rex hui

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 19 days ago by Actipro Software Support - Cleveland, OH, USA

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 19 days ago by rex hui

I understand now. Thank you very much!

Add Comment

Please log in to a validated account to post comments.