• 周六. 4 月 25th, 2026

物嫩软件资讯网

软件资讯来物嫩

一个WPF动态壁纸软件

admin@wunen

4 月 18, 2025



996仙人壁纸



介绍
我们这一生啊,总得熬夜的。
1、实现原理:
    把一个窗口放在桌面壁纸和桌面图标之间,然后在自己的这个窗口播放视频或者动画,这就是一个简单的动态桌面软件。软件是将窗体作为背景,使用WebView2显示内容,通过发送通知实现更新壁纸的效果。
2、基础WPF的动态壁纸软件,支持HTML、图片、视频作为壁纸。可以自行添加各种壁纸,定时更新壁纸。开机自启、壁纸下载等功能。
3、基于NET8环境开发,使用了CommunityToolkit.Mvvm、Hardcodet.NotifyIcon.Wpf、Microsoft.Web.WebView2、Newtonsoft.Json等包。


软件架构
1、DynamicWallpaper
    1、BackgroundWindows  背景窗口
    1、ffmpeg-6.1-full_build  没有用
    1、Hook 没有用
    1、Hook 没有用
    1、HtmlGame  放html背景和htm游戏
    1、Images 图片文件
    1、Models 
    1、Resource 一些静态资源
    1、VM  MVVM用的viewmodel
    1、CommonHelper 一些主要用的操作方法
    1、Config  配置类
    1、MainWindow2 主窗体
2、One996.ControlLibrary
    描述:一些自定义的控件库,重写了button、textblock、checkbox、radiobox几个控件,实现了一个自定义的头像控件以及几个动态效果。
3、One996.Demo
    1、测试项目


核心代码
1、 主要显示窗体:BackgroundPage
2、将窗体设置为背景图层
      public static void RunWindows()
  {
      //Process ffplay = new Process();
      try
      {
          CommonHelper.Logs("Windows显示视频壁纸...");
          //把之前的关掉,否则会重复启动。
          //KillPro();

          //找到最初始的图层
          IntPtr hProgman = DllImports.FindWindow("Progman", "Program Manager");
          // 分裂图层
          DllImports.SendMessageTimeout(hProgman, 0x52c, 0, 0, 0, 100, out _);

          IntPtr workerW = IntPtr.Zero;
          do
          {
              //找到中间图层并让它变透明
              workerW = DllImports.FindWindowEx(IntPtr.Zero, workerW, "workerW", null);
              if (DllImports.GetParent(workerW) == hProgman)
              {
                  DllImports.ShowWindow(workerW, 0);
              }
          } while (workerW != IntPtr.Zero);
          background = new BackgroundWindows.BackgroundPage();
          background.Width=CommonHelper.Config.X;
          background.Height=CommonHelper.Config.Y;
          background.WindowState = WindowState.Normal;
          background.Left = 0;
          background.Top =0;
          background.WindowStartupLocation=WindowStartupLocation.Manual;
          background.Show();
          //((HwndSource)PresentationSource.FromVisual(background)).AddHook(myHook);
          var ints= ((HwndSource)PresentationSource.FromVisual(background)).Handle;
          //将这个动态视频设为最下面那个图层的子图层
          DllImports.SetParent(ints, hProgman);
      }
      catch (Exception ex)
      {
          //show.Content="异常";
          CommonHelper.Logs("壁纸异常:"+ex);
      }
      finally
      {
      }

  }


安装教程
下载exe文件安装,不要安装在C盘!!!!

链接:https://pan.baidu.com/s/1Irnv8-PyzEmwgRIw22vcpw?pwd=5uid

提取码:5uid

–来自百度网盘超级会员V6的分享

开发者:One996

代码仓库:https://gitee.com/one996/996-immortal-wallpaper.git



效果图

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注