diff --git a/Directory.Build.props b/Directory.Build.props index 22eea71..a4ffdbf 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - False + True False $(DefineConstants);USE_WPF 0.4.3 diff --git a/Directory.Build.targets b/Directory.Build.targets index cdc4630..704ef4c 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -3,11 +3,14 @@ C:\Program Files\dotnet + + $(DotnetInstallLocation)\shared\Microsoft.WindowsDesktop.App\8.0.6\Accessibility.dll + - $(DotnetInstallLocation)\shared\Microsoft.WindowsDesktop.App\7.0.10\Accessibility.dll + $(DotnetInstallLocation)\shared\Microsoft.WindowsDesktop.App\7.0.20\Accessibility.dll - $(DotnetInstallLocation)\shared\Microsoft.WindowsDesktop.App\6.0.21\Accessibility.dll + $(DotnetInstallLocation)\shared\Microsoft.WindowsDesktop.App\6.0.27\Accessibility.dll \ No newline at end of file diff --git a/WinFormsComInterop/IDropTargetWrapper.cs b/WinFormsComInterop/IDropTargetWrapper.cs index 8d1d7a3..eff751c 100644 --- a/WinFormsComInterop/IDropTargetWrapper.cs +++ b/WinFormsComInterop/IDropTargetWrapper.cs @@ -4,7 +4,10 @@ namespace WinFormsComInterop; +#if !NET8_0_OR_GREATER [RuntimeCallableWrapper(typeof(primitives::Interop.Ole32.IDropTarget))] +#else +#endif [System.Runtime.Versioning.SupportedOSPlatform("windows")] partial class IDropTargetWrapper { diff --git a/WinFormsComInterop/WinFormsComInterop.csproj b/WinFormsComInterop/WinFormsComInterop.csproj index a58181a..9bcffd4 100644 --- a/WinFormsComInterop/WinFormsComInterop.csproj +++ b/WinFormsComInterop/WinFormsComInterop.csproj @@ -1,7 +1,7 @@  - net6.0;net7.0 + net6.0;net7.0;net8.0 true true enable diff --git a/WinFormsComInterop/WinFormsComWrappers.cs b/WinFormsComInterop/WinFormsComWrappers.cs index 9194835..d0d3fc3 100644 --- a/WinFormsComInterop/WinFormsComWrappers.cs +++ b/WinFormsComInterop/WinFormsComWrappers.cs @@ -15,15 +15,17 @@ namespace WinFormsComInterop [ComCallableWrapper(typeof(primitives::Interop.Ole32.IServiceProvider))] [ComCallableWrapper(typeof(primitives::Interop.UiaCore.IRawElementProviderSimple))] //[ComCallableWrapper(typeof(primitives::Interop.UiaCore.IAccessibleEx))] +#if !NET8_0_OR_GREATER [ComCallableWrapper(typeof(primitives::Interop.Ole32.IDropTarget))] + [ComCallableWrapper(typeof(primitives::Interop.Mshtml.IDocHostUIHandler))] [ComCallableWrapper(typeof(primitives::Interop.Ole32.IStorage))] [ComCallableWrapper(typeof(primitives::Interop.Richedit.IRichEditOleCallback))] +#endif [ComCallableWrapper(typeof(primitives::Interop.Ole32.IOleControlSite))] [ComCallableWrapper(typeof(primitives::Interop.Ole32.IOleInPlaceSite))] [ComCallableWrapper(typeof(primitives::Interop.Ole32.IOleContainer))] [ComCallableWrapper(typeof(primitives::Interop.Ole32.IOleClientSite))] [ComCallableWrapper(typeof(primitives::Interop.Ole32.IOleInPlaceFrame))] - [ComCallableWrapper(typeof(primitives::Interop.Mshtml.IDocHostUIHandler))] [ComCallableWrapper(typeof(primitives::Interop.SHDocVw.DWebBrowserEvents2))] [ComCallableWrapper(typeof(primitives::Interop.Ole32.ISimpleFrameSite))] [ComCallableWrapper(typeof(primitives::Interop.Ole32.IPropertyNotifySink))] @@ -43,9 +45,11 @@ public unsafe partial class WinFormsComWrappers : ComWrappers { static ComWrappers.ComInterfaceEntry* accessibleObjectEntry; static ComWrappers.ComInterfaceEntry* primitivesStreamEntry; +#if !NET8_0_OR_GREATER + static ComWrappers.ComInterfaceEntry* primitivesDropTargetEntry; static ComWrappers.ComInterfaceEntry* storageEntry; +#endif static ComWrappers.ComInterfaceEntry* richEditOleCallbackEntry; - static ComWrappers.ComInterfaceEntry* primitivesDropTargetEntry; static ComWrappers.ComInterfaceEntry* formsWebBrowserSiteEntry; static ComWrappers.ComInterfaceEntry* formsWebBrowserContainerEntry; static ComWrappers.ComInterfaceEntry* formsWebBrowserEventEntry; @@ -107,8 +111,10 @@ static WinFormsComWrappers() enumVariantEntry = CreateEnumVariantEntry(); #endif +#if !NET8_0_OR_GREATER primitivesDropTargetEntry = CreatePrimitivesDropTargetEntry(); storageEntry = CreatePrimitivesIStorageEntry(); +#endif richEditOleCallbackEntry = CreatePrimitivesIRichEditOleCallbackEntry(); formsWebBrowserSiteEntry = CreateWebBrowserSiteEntry(); formsWebBrowserContainerEntry = CreateWebBrowserContainerEntry(); @@ -160,6 +166,7 @@ static WinFormsComWrappers() } #endif +#if !NET8_0_OR_GREATER private static ComInterfaceEntry* CreatePrimitivesDropTargetEntry() { CreatePrimitivesIDropTargetProxyVtbl(out var vtbl); @@ -192,6 +199,22 @@ static WinFormsComWrappers() wrapperEntry->Vtable = vtbl; return wrapperEntry; } +#else + + private static ComInterfaceEntry* CreatePrimitivesIRichEditOleCallbackEntry() + { + var vtblRaw = (System.IntPtr*)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(global::WinFormsComInterop.WinFormsComWrappers), sizeof(System.IntPtr) * 13); + GetIUnknownImpl(out vtblRaw[0], out vtblRaw[1], out vtblRaw[2]); + primitives::Windows.Win32.UI.Controls.RichEdit.IRichEditOleCallback.PopulateVTable((primitives::Windows.Win32.UI.Controls.RichEdit.IRichEditOleCallback.Vtbl*)vtblRaw); + var vtbl = (System.IntPtr)vtblRaw; + + var comInterfaceEntryMemory = RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(WinFormsComWrappers), sizeof(ComInterfaceEntry) * 1); + var wrapperEntry = (ComInterfaceEntry*)comInterfaceEntryMemory.ToPointer(); + wrapperEntry->IID = IID_IRichEditOleCallback; + wrapperEntry->Vtable = vtbl; + return wrapperEntry; + } +#endif private static ComInterfaceEntry* CreateAccessibleObjectEntry() { CreatePrimitivesIRawElementProviderSimpleProxyVtbl(out var rawElementProviderSimpleVtbl); @@ -208,7 +231,9 @@ static WinFormsComWrappers() private static ComInterfaceEntry* CreateWebBrowserSiteEntry() { CreatePrimitivesIOleControlSiteProxyVtbl(out var oleControlSiteVtbl); +#if !NET8_0_OR_GREATER CreatePrimitivesIDocHostUIHandlerProxyVtbl(out var docHostUIHandlerVtbl); +#endif CreatePrimitivesIOleInPlaceSiteProxyVtbl(out var oleInPlaceSiteVtbl); CreatePrimitivesIOleClientSiteProxyVtbl(out var oleClientSiteVtbl); CreatePrimitivesISimpleFrameSiteProxyVtbl(out var simpleFrameSiteVtbl); @@ -218,8 +243,10 @@ static WinFormsComWrappers() var wrapperEntry = (ComInterfaceEntry*)comInterfaceEntryMemory.ToPointer(); wrapperEntry[0].IID = IID_IOleControlSite; wrapperEntry[0].Vtable = oleControlSiteVtbl; +#if !NET8_0_OR_GREATER wrapperEntry[1].IID = IID_IDocHostUIHandler; wrapperEntry[1].Vtable = docHostUIHandlerVtbl; +#endif wrapperEntry[2].IID = IID_IOleInPlaceSite; wrapperEntry[2].Vtable = oleInPlaceSiteVtbl; wrapperEntry[3].IID = IID_IOleClientSite; @@ -305,7 +332,7 @@ static WinFormsComWrappers() return primitivesStreamEntry; } #endif - +#if !NET8_0_OR_GREATER if (obj is primitives::Interop.Ole32.IDropTarget) { count = 1; @@ -323,6 +350,13 @@ static WinFormsComWrappers() count = 1; return richEditOleCallbackEntry; } +#else + if (obj is primitives::Windows.Win32.UI.Controls.RichEdit.IRichEditOleCallback.Interface) + { + count = 1; + return richEditOleCallbackEntry; + } +#endif #if USE_WPF if (obj is winbase::MS.Win32.UnsafeNativeMethods.IOleDropTarget) diff --git a/facades/System.Windows.Forms.Primitives/Mshtml/Interop.IDocHostUIHandler.cs b/facades/System.Windows.Forms.Primitives/Mshtml/Interop.IDocHostUIHandler.cs index 60fc35a..63e70bf 100644 --- a/facades/System.Windows.Forms.Primitives/Mshtml/Interop.IDocHostUIHandler.cs +++ b/facades/System.Windows.Forms.Primitives/Mshtml/Interop.IDocHostUIHandler.cs @@ -7,6 +7,7 @@ using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; +#if !NET8_0_OR_GREATER public partial class Interop { public partial class Mshtml @@ -92,3 +93,4 @@ HRESULT FilterDataObject( } } } +#endif \ No newline at end of file diff --git a/facades/System.Windows.Forms.Primitives/Ole32/Interop.IDropTarget.cs b/facades/System.Windows.Forms.Primitives/Ole32/Interop.IDropTarget.cs index 8aa93d6..5466956 100644 --- a/facades/System.Windows.Forms.Primitives/Ole32/Interop.IDropTarget.cs +++ b/facades/System.Windows.Forms.Primitives/Ole32/Interop.IDropTarget.cs @@ -6,6 +6,7 @@ using System.Drawing; using System.Runtime.InteropServices; +#if !NET8_0_OR_GREATER public partial class Interop { public static partial class Ole32 @@ -42,3 +43,4 @@ HRESULT Drop( } } } +#endif diff --git a/facades/System.Windows.Forms.Primitives/Ole32/Interop.IStorage.cs b/facades/System.Windows.Forms.Primitives/Ole32/Interop.IStorage.cs index 1d17d10..e21d854 100644 --- a/facades/System.Windows.Forms.Primitives/Ole32/Interop.IStorage.cs +++ b/facades/System.Windows.Forms.Primitives/Ole32/Interop.IStorage.cs @@ -6,6 +6,7 @@ using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; +#if !NET8_0_OR_GREATER public partial class Interop { public static partial class Ole32 @@ -83,3 +84,4 @@ void SetElementTimes( } } } +#endif diff --git a/facades/System.Windows.Forms.Primitives/Richedit/Interop.CHARRANGE.cs b/facades/System.Windows.Forms.Primitives/Richedit/Interop.CHARRANGE.cs index a02a188..f3829cd 100644 --- a/facades/System.Windows.Forms.Primitives/Richedit/Interop.CHARRANGE.cs +++ b/facades/System.Windows.Forms.Primitives/Richedit/Interop.CHARRANGE.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#if !NET8_0_OR_GREATER using System.Runtime.InteropServices; public partial class Interop @@ -16,3 +17,11 @@ public struct CHARRANGE } } } +#else +internal struct CHARRANGE +{ + internal int cpMin; + + internal int cpMax; +} +#endif \ No newline at end of file diff --git a/facades/System.Windows.Forms.Primitives/Richedit/Interop.IRichEditOleCallback.cs b/facades/System.Windows.Forms.Primitives/Richedit/Interop.IRichEditOleCallback.cs index 0991e22..adbfa27 100644 --- a/facades/System.Windows.Forms.Primitives/Richedit/Interop.IRichEditOleCallback.cs +++ b/facades/System.Windows.Forms.Primitives/Richedit/Interop.IRichEditOleCallback.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. + +#if !NET8_0_OR_GREATER using System; using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; @@ -50,3 +52,37 @@ HRESULT GetDragDropEffect( } } } +#else +// Windows.Win32.UI.Controls.RichEdit.IRichEditOleCallback +using System; +using System.CodeDom.Compiler; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Versioning; + +namespace Windows.Win32.UI.Controls.RichEdit +{ + + [Guid("00020D03-0000-0000-C000-000000000046")] + [SupportedOSPlatform("windows6.0.6000")] + [GeneratedCode("Microsoft.Windows.CsWin32", "0.3.36-beta+6a5076f50a")] + public struct IRichEditOleCallback //: IVTable, IVTable, IComIID + { + public struct Vtbl + { + } + + [ComImport] + [Guid("00020D03-0000-0000-C000-000000000046")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + [SupportedOSPlatform("windows6.0.6000")] + public interface Interface + { + } + + public unsafe static void PopulateVTable(Vtbl* vtable) + { + } + } +} +#endif diff --git a/facades/System.Windows.Forms.Primitives/System.Windows.Forms.Primitives.csproj b/facades/System.Windows.Forms.Primitives/System.Windows.Forms.Primitives.csproj index e0aa35f..94f5341 100644 --- a/facades/System.Windows.Forms.Primitives/System.Windows.Forms.Primitives.csproj +++ b/facades/System.Windows.Forms.Primitives/System.Windows.Forms.Primitives.csproj @@ -1,7 +1,7 @@ - net6.0;net7.0 + net6.0;net7.0;net8.0 true 6.0.0.0 6.0.0.0 diff --git a/facades/System.Windows.Forms/System.Windows.Forms.csproj b/facades/System.Windows.Forms/System.Windows.Forms.csproj index e0aa35f..94f5341 100644 --- a/facades/System.Windows.Forms/System.Windows.Forms.csproj +++ b/facades/System.Windows.Forms/System.Windows.Forms.csproj @@ -1,7 +1,7 @@ - net6.0;net7.0 + net6.0;net7.0;net8.0 true 6.0.0.0 6.0.0.0 diff --git a/global.json b/global.json index efc0688..2e44195 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.100", + "version": "8.0.200", "allowPrerelease": true, "rollForward": "major" } diff --git a/samples/HostedWindowsForms/HostedWindowsForms.csproj b/samples/HostedWindowsForms/HostedWindowsForms.csproj index a702377..5c41a75 100644 --- a/samples/HostedWindowsForms/HostedWindowsForms.csproj +++ b/samples/HostedWindowsForms/HostedWindowsForms.csproj @@ -1,7 +1,7 @@  - net7.0-windows + net8.0-windows enable true enable diff --git a/samples/SampleVisualBasic/SampleVisualBasic.vbproj b/samples/SampleVisualBasic/SampleVisualBasic.vbproj index 6d9ae3e..4918d67 100644 --- a/samples/SampleVisualBasic/SampleVisualBasic.vbproj +++ b/samples/SampleVisualBasic/SampleVisualBasic.vbproj @@ -2,7 +2,7 @@ WinExe - net7.0-windows + net8.0-windows Sub Main true WindowsForms diff --git a/samples/SampleWindowsForms/SampleWindowsForms.csproj b/samples/SampleWindowsForms/SampleWindowsForms.csproj index 1afc8dd..c2c09da 100644 --- a/samples/SampleWindowsForms/SampleWindowsForms.csproj +++ b/samples/SampleWindowsForms/SampleWindowsForms.csproj @@ -3,7 +3,7 @@ WinExe - net7.0-windows + net8.0-windows True enable <_SuppressWinFormsTrimError>true @@ -75,7 +75,7 @@ - + diff --git a/samples/TrimmingSample/TrimmingSample.csproj b/samples/TrimmingSample/TrimmingSample.csproj index ca35bc3..c0313c1 100644 --- a/samples/TrimmingSample/TrimmingSample.csproj +++ b/samples/TrimmingSample/TrimmingSample.csproj @@ -2,7 +2,7 @@ WinExe - net7.0-windows + net8.0-windows enable true enable