// ------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> // ------------------------------------------------------------------------------ #pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981,SYSLIB1092,CS3021,CS3019 using global::System; using global::System.Diagnostics; using global::System.Diagnostics.CodeAnalysis; using global::System.Runtime.CompilerServices; using global::System.Runtime.InteropServices; using global::System.Runtime.Versioning; using winmdroot = global::Windows.Win32; namespace Windows.Win32 { /// <content> /// Contains extern methods from "dwmapi.dll". /// </content> internal static partial class PInvoke { /// <inheritdoc cref="DwmGetWindowAttribute(winmdroot.Foundation.HWND, winmdroot.Graphics.Dwm.DWMWINDOWATTRIBUTE, void*, uint)"/> [SupportedOSPlatform("windows6.0.6000")] internal static unsafe winmdroot.Foundation.HRESULT DwmGetWindowAttribute(winmdroot.Foundation.HWND hwnd, winmdroot.Graphics.Dwm.DWMWINDOWATTRIBUTE dwAttribute, Span<byte> pvAttribute) { fixed (byte* pvAttributeLocal = pvAttribute) { winmdroot.Foundation.HRESULT __result = PInvoke.DwmGetWindowAttribute(hwnd, dwAttribute, (void* )pvAttributeLocal, (uint )pvAttribute.Length); return __result; } } /// <summary>Retrieves the current value of a specified Desktop Window Manager (DWM) attribute applied to a window.</summary> /// <param name="hwnd">The handle to the window from which the attribute value is to be retrieved.</param> /// <param name="dwAttribute">A flag describing which value to retrieve, specified as a value of the [DWMWINDOWATTRIBUTE](/windows/desktop/api/dwmapi/ne-dwmapi-dwmwindowattribute) enumeration. This parameter specifies which attribute to retrieve, and the *pvAttribute* parameter points to an object into which the attribute value is retrieved.</param> /// <param name="pvAttribute">A pointer to a value which, when this function returns successfully, receives the current value of the attribute. The type of the retrieved value depends on the value of the *dwAttribute* parameter. The [**DWMWINDOWATTRIBUTE**](/windows/desktop/api/Dwmapi/ne-dwmapi-dwmwindowattribute) enumeration topic indicates, in the row for each flag, what type of value you should pass a pointer to in the *pvAttribute* parameter.</param> /// <param name="cbAttribute">The size, in bytes, of the attribute value being received via the *pvAttribute* parameter. The type of the retrieved value, and therefore its size in bytes, depends on the value of the *dwAttribute* parameter.</param> /// <returns> /// <para>Type: **[HRESULT](/windows/desktop/com/structure-of-com-error-codes)** If the function succeeds, it returns **S_OK**. Otherwise, it returns an [**HRESULT**](/windows/desktop/com/structure-of-com-error-codes) [error code](/windows/desktop/com/com-error-codes-10).</para> /// </returns> /// <remarks> /// <para><see href="https://learn.microsoft.com/windows/win32/api/dwmapi/nf-dwmapi-dwmgetwindowattribute">Learn more about this API from learn.microsoft.com</see>.</para> /// </remarks> [SupportedOSPlatform("windows6.0.6000")] internal static unsafe winmdroot.Foundation.HRESULT DwmGetWindowAttribute(winmdroot.Foundation.HWND hwnd, winmdroot.Graphics.Dwm.DWMWINDOWATTRIBUTE dwAttribute, void* pvAttribute, uint cbAttribute) { winmdroot.Foundation.HRESULT __retVal = LocalExternFunction(hwnd, (uint)dwAttribute, pvAttribute, cbAttribute); return __retVal; [DllImport("dwmapi.dll", ExactSpelling = true, EntryPoint = "DwmGetWindowAttribute"),DefaultDllImportSearchPaths(DllImportSearchPath.System32)] static extern unsafe winmdroot.Foundation.HRESULT LocalExternFunction(winmdroot.Foundation.HWND hwnd, uint dwAttribute, void* pvAttribute, uint cbAttribute); } /// <inheritdoc cref="DwmSetWindowAttribute(winmdroot.Foundation.HWND, winmdroot.Graphics.Dwm.DWMWINDOWATTRIBUTE, void*, uint)"/> [SupportedOSPlatform("windows6.0.6000")] internal static unsafe winmdroot.Foundation.HRESULT DwmSetWindowAttribute(winmdroot.Foundation.HWND hwnd, winmdroot.Graphics.Dwm.DWMWINDOWATTRIBUTE dwAttribute, ReadOnlySpan<byte> pvAttribute) { fixed (byte* pvAttributeLocal = pvAttribute) { winmdroot.Foundation.HRESULT __result = PInvoke.DwmSetWindowAttribute(hwnd, dwAttribute, (void* )pvAttributeLocal, (uint )pvAttribute.Length); return __result; } } /// <summary>Sets the value of Desktop Window Manager (DWM) non-client rendering attributes for a window.</summary> /// <param name="hwnd">The handle to the window for which the attribute value is to be set.</param> /// <param name="dwAttribute">A flag describing which value to set, specified as a value of the [DWMWINDOWATTRIBUTE](/windows/desktop/api/dwmapi/ne-dwmapi-dwmwindowattribute) enumeration. This parameter specifies which attribute to set, and the *pvAttribute* parameter points to an object containing the attribute value.</param> /// <param name="pvAttribute">A pointer to an object containing the attribute value to set. The type of the value set depends on the value of the *dwAttribute* parameter. The [**DWMWINDOWATTRIBUTE**](/windows/desktop/api/Dwmapi/ne-dwmapi-dwmwindowattribute) enumeration topic indicates, in the row for each flag, what type of value you should pass a pointer to in the *pvAttribute* parameter.</param> /// <param name="cbAttribute">The size, in bytes, of the attribute value being set via the *pvAttribute* parameter. The type of the value set, and therefore its size in bytes, depends on the value of the *dwAttribute* parameter.</param> /// <returns> /// <para>Type: **[HRESULT](/windows/desktop/com/structure-of-com-error-codes)** If the function succeeds, it returns **S_OK**. Otherwise, it returns an [**HRESULT**](/windows/desktop/com/structure-of-com-error-codes) [error code](/windows/desktop/com/com-error-codes-10). If Desktop Composition has been disabled (Windows 7 and earlier), then this function returns **DWM_E_COMPOSITIONDISABLED**.</para> /// </returns> /// <remarks>It's not valid to call this function with the *dwAttribute* parameter set to **DWMWA_NCRENDERING_ENABLED**. To enable or disable non-client rendering, you should use the **DWMWA_NCRENDERING_POLICY** attribute, and set the desired value. For more info, and a code example, see [Controlling non-client region rendering](/windows/desktop/dwm/composition-ovw#controlling-non-client-region-rendering).</remarks> [SupportedOSPlatform("windows6.0.6000")] internal static unsafe winmdroot.Foundation.HRESULT DwmSetWindowAttribute(winmdroot.Foundation.HWND hwnd, winmdroot.Graphics.Dwm.DWMWINDOWATTRIBUTE dwAttribute, void* pvAttribute, uint cbAttribute) { winmdroot.Foundation.HRESULT __retVal = LocalExternFunction(hwnd, (uint)dwAttribute, pvAttribute, cbAttribute); return __retVal; [DllImport("dwmapi.dll", ExactSpelling = true, EntryPoint = "DwmSetWindowAttribute"),DefaultDllImportSearchPaths(DllImportSearchPath.System32)] static extern unsafe winmdroot.Foundation.HRESULT LocalExternFunction(winmdroot.Foundation.HWND hwnd, uint dwAttribute, void* pvAttribute, uint cbAttribute); } } }