基于WebView2实现的Win11桌面框架,利用插件自定义
Moli
2026-05-04 ddd6889459bccf5015cd0c9629cdf4f4ce8fb8e1
src/Moli.Desktop/Interop/WorkerWDesktopLayerStrategy.cs
@@ -1,5 +1,5 @@
using Moli.Desktop.Configuration;
using Moli.Desktop.Diagnostics;
using Moli.Desktop.Layout;
namespace Moli.Desktop.Interop;
@@ -17,7 +17,7 @@
    public bool IsSupported() => NativeMethods.FindWindow("Progman", null) != IntPtr.Zero;
    public bool TryAttachWallpaperWindow(IntPtr hwnd, MonitorInfo monitor, out string? error)
    public bool TryAttachDesktopWindow(IntPtr hwnd, RectD bounds, out string? error)
    {
        error = null;
        var workerW = FindWorkerW();
@@ -45,10 +45,10 @@
        if (!NativeMethods.SetWindowPos(
            hwnd,
            IntPtr.Zero,
            (int)monitor.Bounds.X,
            (int)monitor.Bounds.Y,
            (int)monitor.Bounds.Width,
            (int)monitor.Bounds.Height,
            (int)bounds.X,
            (int)bounds.Y,
            (int)bounds.Width,
            (int)bounds.Height,
            NativeMethods.SwpNoZOrder | NativeMethods.SwpNoActivate | NativeMethods.SwpShowWindow))
        {
            error = $"SetWindowPos failed with {NativeMethods.GetLastError()}";