前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >桌面自定义(WorkerW)

桌面自定义(WorkerW)

作者头像
sofu456
发布2019-12-03 15:48:46
1.4K0
发布2019-12-03 15:48:46
举报
文章被收录于专栏:sofu456sofu456

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

本文链接:https://blog.csdn.net/daoer_sofu/article/details/103257899

360桌面助手

使用spy++获取窗口层级关系

在这里插入图片描述
在这里插入图片描述
  • workerw窗口获取到后,setparent
  • 360桌面助手窗口是最大化的,所以可以通过截图,获取每个图标的大小和位置,再在360桌面窗口上绘制(如果窗口不是最大化,设置为透明就可以了)

获取workw窗口

使用C#代码调用windows api接口,调试模式下设置窗口parnet会失败

代码语言:javascript
复制
private void SetBackgroundWindowWorkerW()
        {
            Win32Methods.EnumWindows(new Win32Methods.EnumWindowsProc((h, l) => {
                int winClassCount = 0;
                IntPtr winClassPt = Marshal.AllocHGlobal(512);
                if (Win32Methods.GetClassName(h, winClassPt, out winClassCount) != 0)
                {
                    string winClass = Marshal.PtrToStringAnsi(winClassPt);
                    if (Win32Methods.IsWindowVisible(h) && winClass == "WorkerW")
                    {
                        //System.Windows.MessageBox.Show("ok");
                        long wStyle = Win32Methods.GetWindowLong(_mainHandle, -16);
                        Win32Methods.SetWindowLong(_mainHandle, -16, 0x40000000L | wStyle);
                        wStyle = Win32Methods.GetWindowLong(_mainHandle, -16);
                        Win32Methods.SetParent(_mainHandle, h);
                        Win32Methods.SetWindowPos(_mainHandle, new IntPtr(0), 0, 0, 0, 0, 0x0002 | 0x0001);

                        return false;
                    }
                    else
                    {
                        return true;
                    }
                }
                Marshal.FreeHGlobal(winClassPt);
                return true;
            }), 0);
        }

获取桌面图标

shelldll_defview => syslistview32(FolderView)窗口 int count = (int)SendMessage(desktophwnd, LVM_GETITEMCOUNT, (WPARAM)0, (LPARAM)0);

窗口api

GetShellWindow 获取shelldll_defview窗口

参考:https://blog.csdn.net/f919974096/article/details/89479630 https://zhuanlan.zhihu.com/p/37877070(过渡窗口workerw的讲解)

github:https://github.com/NoisyWinds/Wallpaper.git

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019-11-26 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 360桌面助手
  • 获取workw窗口
  • 获取桌面图标
  • 窗口api
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档