From 4bff53b87c1726d9a75c38757fd9d3aa2fb14e5e Mon Sep 17 00:00:00 2001 From: harborsiem Date: Sun, 5 Nov 2023 17:45:17 +0100 Subject: [PATCH] Delete HBITMAP small fixes --- Ribbon/Interop/RibbonCOMInterfaces.cs | 2 +- Ribbon/Interop/StreamAdapter.cs | 1 - Ribbon/Ribbon.cs | 1 + RibbonTools/Misc/AlphaBitmap.cs | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Ribbon/Interop/RibbonCOMInterfaces.cs b/Ribbon/Interop/RibbonCOMInterfaces.cs index 6f037fc..83c53f9 100644 --- a/Ribbon/Interop/RibbonCOMInterfaces.cs +++ b/Ribbon/Interop/RibbonCOMInterfaces.cs @@ -768,7 +768,7 @@ public interface IUIImageFromBitmap HRESULT CreateImage(IntPtr bitmap, Ownership options, [Out, MarshalAs(UnmanagedType.Interface)] out IUIImage image); } - //following types and interfaces are in UIRibbon since Windows 8, not used yet + //following types and interfaces are in UIRibbon since Windows 8 /// /// Identifies the types of events associated with a Ribbon. /// UI_EVENTTYPE enum diff --git a/Ribbon/Interop/StreamAdapter.cs b/Ribbon/Interop/StreamAdapter.cs index c163ed3..766f0b0 100644 --- a/Ribbon/Interop/StreamAdapter.cs +++ b/Ribbon/Interop/StreamAdapter.cs @@ -42,7 +42,6 @@ public StreamAdapter(Stream stream) /// public void Clone(out IStream streamCopy) { - streamCopy = null; throw new NotSupportedException(); } diff --git a/Ribbon/Ribbon.cs b/Ribbon/Ribbon.cs index 5593a28..e71fe7f 100644 --- a/Ribbon/Ribbon.cs +++ b/Ribbon/Ribbon.cs @@ -1272,6 +1272,7 @@ public static unsafe Bitmap GetBitmap(IUIImage uiImage) { managedBitmap = Bitmap.FromHbitmap(hBitmap); } + //PInvoke.DeleteObject(hBitmap); //Maybe not a good idea return managedBitmap; } diff --git a/RibbonTools/Misc/AlphaBitmap.cs b/RibbonTools/Misc/AlphaBitmap.cs index b2a5df4..f5217c8 100644 --- a/RibbonTools/Misc/AlphaBitmap.cs +++ b/RibbonTools/Misc/AlphaBitmap.cs @@ -197,9 +197,9 @@ public unsafe static Bitmap FromHbitmap(IntPtr hBitmap) } else { - //NativeMethods.DeleteObject((IntPtr)(void*)&bitmapStruct); managedBitmap = Bitmap.FromHbitmap(hBitmap); } + NativeMethods.DeleteObject(hBitmap); return managedBitmap; }