渲染到桌面
我希望能够将某个东西渲染成壁纸一样。我使用 Windows,并且更喜欢 DirectX。我知道VLC可以在DirectX模式下渲染带有壁纸的视频,所以这是可能的。
那么,一个简单的问题是,如何将渲染目标设置为像 Windows 中的壁纸一样渲染?
I want to be able to render a thing as if it was a wallpaper. I use Windows, and I prefer DirectX. I know that VLC can render the video has a wallpaper in DirectX mode, so it's possible.
So, a quick question, How could I set the rendertarget to render like if it was a wallpaper in Windows?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
下面是一些代码,它们将为您提供一个窗口的句柄(HWND),该窗口可用于在 Windows 桌面上进行绘制。其工作原理的主要问题是桌面图标仍然存在,但这将允许您在它们之上进行绘制。如果您希望图标正常显示(您的内容在它们后面),您需要在绘制内容后重新绘制它们,或者找到一种方法来避免首先绘制它们。这是相当重要的,也是我从未完全解决的问题。
这绝对适用于 XP 和 Windows 7(带有 Areo),以获得普通 GDI 绘图可以使用的东西。我从未使用 DirectX 测试过它,但我怀疑如果您使用 hMainWnd 作为演示窗口,它会起作用。
...然后进行绘图(使用 GDI),类似这样...
...并使用桌面图标的区域更新
ValidRGN
。通过对桌面的列表视图控制窗口进行一些操作就可以找到这些内容。这是相当复杂的,可能与这个问题无关。Here is some code which will get you a handle (HWND) to a window that can be used to draw over top of the windows Desktop. The main issue with how this works is that the desktop icons are still present but this will allow you to draw over top of them. If you want the icons to appear as normal (with your stuff behind them) you need to redraw them after you've drawn your stuff, or find a way to avoid drawing over them in the first place. This is fairly non-trivial and something I never completely solved.
This definitely works on XP and Windows 7 (with Areo) for getting something that normal GDI drawing can use. I've never tested it with DirectX but I suspect it would work if you used hMainWnd as your presentation window.
... and then for drawing (using GDI), something like this...
... and update
ValidRGN
with the regions of the Desktop icons. Those can be found with a bit of work with the Desktop's listview control window. That is fairly complicated and maybe off topic for this question.