mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Fix bitmap creation error in Explorer plugin shell integration
This commit is contained in:
parent
a8e2927f2a
commit
0969fc12cb
1 changed files with 19 additions and 10 deletions
|
|
@ -285,19 +285,28 @@ public static class ShellContextMenuDisplayHelper
|
|||
|
||||
private static BitmapSource GetBitmapSourceFromHBitmap(IntPtr hBitmap)
|
||||
{
|
||||
var bitmapSource = Imaging.CreateBitmapSourceFromHBitmap(
|
||||
hBitmap,
|
||||
IntPtr.Zero,
|
||||
Int32Rect.Empty,
|
||||
BitmapSizeOptions.FromWidthAndHeight(32, 32)
|
||||
);
|
||||
|
||||
if (!DeleteObject(hBitmap))
|
||||
try
|
||||
{
|
||||
throw new Exception("Failed to delete HBitmap.");
|
||||
var bitmapSource = Imaging.CreateBitmapSourceFromHBitmap(
|
||||
hBitmap,
|
||||
IntPtr.Zero,
|
||||
Int32Rect.Empty,
|
||||
BitmapSizeOptions.FromWidthAndHeight(32, 32)
|
||||
);
|
||||
|
||||
if (!DeleteObject(hBitmap))
|
||||
{
|
||||
throw new Exception("Failed to delete HBitmap.");
|
||||
}
|
||||
|
||||
return bitmapSource;
|
||||
}
|
||||
catch (COMException)
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
|
||||
return bitmapSource;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue