public IntPtr GetHBitmap(System.Windows.Size size, Boolean isCopyItem = false)
{
if (shellItemNative == null) return IntPtr.Zero;
// Create a size structure to pass to the native method
var nativeSIZE = new Size() { Width = Convert.ToInt32(size.Width), Height = Convert.ToInt32(size.Height) };
var nativeItem = isCopyItem && !this._Item.IsSearchFolder && this._Item.DisplayName != "Search.search-ms"
? new ShellItem(this._Item.CachedParsingName.ToShellParsingName()).ComInterface
: shellItemNative;
// Use IShellItemImageFactory to get an icon
// Options passed in: Resize to fit
IntPtr hbitmap = IntPtr.Zero;
HResult hr = ((IShellItemImageFactory)nativeItem).GetImage(nativeSIZE, CalculateFlags(), out hbitmap);
return hr == HResult.S_OK ? hbitmap : IntPtr.Zero;
}